feat(sdk,ingest): record column-level lineage on metrics
Closed
AN
3d ago+816+816+012345678901234567890123456789-39-39-01234567890123456789
Summary
- Add
Metric.set_upstreams(datasets=, fields=)so column parents are derived intodatasetUpstreamsand both upstream lists are always written.set_upstream_datasetsremains as a deprecated alias that clears column edges. - Snowflake semantic views emit
fieldUpstreamsonly for facts and dimensions whose logical dataset is already a dataset upstream. Physical column mapping stays on the logical dataset.
Test plan
-
pytest metadata-ingestion/tests/unit/sdk/test_metric.py -
pytest metadata-ingestion/tests/unit/snowflake/test_snowflake_semantic_model.py - Confirm a Snowflake semantic-view ingest writes logical schemaField edges on
metricUpstreamsand leaves physical column lineage on the logical dataset
Made with Cursor
Summary by cubic
Records column-level lineage on metrics: the Python SDK gains Metric.set_upstreams(datasets=..., fields=...), and Snowflake semantic views emit column edges for facts and dimensions whose logical dataset is already a dataset upstream. metricUpstreams now always writes both datasetUpstreams and fieldUpstreams so re-ingestion clears stale table and column edges. Physical column mapping stays on the logical dataset.
Migration
- Replace
Metric.set_upstream_datasets(...)withset_upstreams(datasets=...); the old alias is deprecated and clears column edges. - Pass
fields=self.upstream_fieldswhen re-emitting a graph-hydrated metric —metricUpstreamsis a snapshot, not a patch, so omitting fields drops server-side column lineage.