feat(ingest/microstrategy): column-level lineage for semantic model datasets and metrics

Merged
AC
3d ago
+394-25

Semantic model datasets only carried table-level upstreams, and metrics only linked to the semantic model datasets, not to their fields. The report datasets already had field-level lineage from the same /api/model/tables payload; the semantic model pass never used it.

  • Physical tables: each fact and attribute maps to the warehouse columns named in its expression (an attribute's forms are combined), with casing taken from the warehouse schema in DataHub when it is there. This is emitted as upstreamLineage.fineGrainedLineages on the semantic model dataset.
  • Logical views: the view SQL is parsed with the fact and attribute expression columns as its outputs, so each field traces through the SQL to base-table columns.
  • Metrics: metricUpstreams.fieldUpstreams now points at the semantic model dataset fields of the facts and attributes the metric uses (consolidations included). It is written even when empty, so a re-ingest clears stale edges. The SDK setter it uses comes from #21741 at the bottom of the stack.

Lineage now reads metric → semantic model dataset field → warehouse column. semantic_model_column_lineage_fields counts the dataset fields that get column lineage. When an upstream table's schema can't be read from DataHub, neither a physical table nor a logical view writes upstreamLineage that run, so the existing field lineage stays.

extract_field_names_from_expression no longer reads quoted text or name( calls as columns. For example, ApplySimple("ToNumber(#0)", CLASS) gives CLASS, not applysimple/tonumber. This also removes such phantom columns from existing report-dataset column lineage.

Unit tests cover:

  • a physical table (fact plus multi-form attribute);
  • a logical view joined across two tables;
  • failed lookups for both a physical table and a logical view;
  • metric field upstreams;
  • the expression parser.

šŸ¤– Generated with Claude Code