feat: auto-apply Snowflake ownership object tags on publish#26
Open
Vinay Shende (vinay79n) wants to merge 4 commits into
Open
feat: auto-apply Snowflake ownership object tags on publish#26Vinay Shende (vinay79n) wants to merge 4 commits into
Vinay Shende (vinay79n) wants to merge 4 commits into
Conversation
… tables which get published.
There was a problem hiding this comment.
Pull request overview
Adds first-class Snowflake table-ownership tagging to the Metaflow publish “chokepoints” and introduces an admin helper view that surfaces those tags via a central registry view.
Changes:
- Introduces
_snowflake/object_tags.pyto derive/validate ownership tags, generateALTER TABLE … SET TAGSQL, and apply tags (warn-only on tagging failures). - Wires optional
tagsoverrides intopublish()andpublish_pandas()and applies tags for production tables. - Adds
create_ownership_registry_view()+ docs to create/query theTABLE_OWNERSHIP_REGISTRYview; bumps version to0.5.0.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Bumps locked project version to 0.5.0. |
| pyproject.toml | Bumps package version to 0.5.0 and updates authors. |
| src/ds_platform_utils/_snowflake/object_tags.py | New tag derivation/SQL builder/apply helpers for Snowflake object tags. |
| src/ds_platform_utils/metaflow/write_audit_publish.py | Adds tags parameter and applies tags post-SWAP in production. |
| src/ds_platform_utils/metaflow/pandas.py | Adds tags parameter and applies tags in production for both direct and S3-stage paths. |
| src/ds_platform_utils/metaflow/registry.py | New helper to create the ownership registry view in Snowflake. |
| src/ds_platform_utils/metaflow/init.py | Exports create_ownership_registry_view. |
| tests/unit_tests/snowflake/test__object_tags.py | New unit tests for tag derivation, SQL construction, and apply behavior. |
| README.md | Links to the new create_ownership_registry_view docs page. |
| docs/metaflow/publish.md | Documents the new tags param and ownership-tag behavior. |
| docs/metaflow/publish_pandas.md | Documents the new tags param and ownership-tag behavior. |
| docs/metaflow/create_ownership_registry_view.md | New docs for creating/querying the registry view. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…proved error handling , github copilot suggested code chnages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the table-ownership RFC (RFC: Snowflake table ownership via object tag) by tagging tables through the existing
publish chokepoint instead of hundreds of hand-written ALTER statements.
_snowflake/object_tags.py:build_table_tags(derive OWNER/TEAM/DOMAIN/PROJECT from Metaflow context, default STATUS=active, validate STATUS/SLA),
build_set_tag_sql, andapply_table_tags(warn-don't-fail on missing tag defs)publish()andpublish_pandas()via a new optionaltagsoverride; non-prod (DATA_SCIENCE_STAGE) runs are left untouchedmetaflow/registry.py:create_ownership_registry_view()+ TABLE_OWNERSHIP_REGISTRY view (plain view, adoption-based, no refresh needed)
object_tags.py)publish/publish_pandasownership-tags sections, registry view pageClickUp card - DS-2491