metricflow_ingest

Convert MetricFlow semantic models and metrics into ktx semantic layer sources.

1.6k|101|Updated May 10, 2026
One-click install
npx skills add https://github.com/Kaelio/ktx --skill metricflow-ingest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: metricflow_ingest
Source: https://github.com/Kaelio/ktx/tree/main/packages/cli/src/skills/metricflow_ingest
Command: npx skills add https://github.com/Kaelio/ktx --skill metricflow-ingest

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrating MetricFlow semantic models and metrics into the ktx semantic layer requires manual translation of measures, entities, joins, and metric types, which is error-prone and slow when done by hand.

Core Features & Use Cases

  • Primitive Mapping: Translates MetricFlow semantic_models, measures, entities, and metrics into ktx overlays, standalones, joins, and derived measures using a defined mapping table.
  • Inheritance Flattening: Resolves extends: chains and cross-model metric references into a single flattened overlay with provenance tags per source file.
  • Metric-Type Handling: Covers simple, derived, ratio, cumulative (via SQL standalone fallback), and conversion metrics (flagged for human review), with four worked examples.
  • Use Case: When ingesting a dbt MetricFlow project containing semantic_models: and metrics: YAML files, load this Skill to emit verified ktx SL sources with identifier checks via entity_details and sql_execution probes.

Quick Start

Load this Skill and ingest the MetricFlow YAML files in this WorkUnit into ktx semantic layer sources, verifying every table and column against the warehouse before writing.

Frequently Asked Questions about metricflow_ingest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate MetricFlow semantic models to the ktx semantic layer?

Map each MetricFlow semantic_model to a ktx overlay or standalone source, converting measures to inlined aggregation expressions, primary entities to grain, and foreign entities to joins. Flatten any extends chains into a single overlay before writing.

How are MetricFlow metric types converted to ktx measures?

Simple metrics become measures with inlined aggregations or filtered measures, derived and ratio metrics become derived measures with safe division, cumulative metrics become standalone SQL sources with window functions, and conversion metrics are flagged for human review.

Does ktx support MetricFlow cumulative or conversion metrics?

ktx SL has no first-class cumulative or conversion primitives in v1. Cumulative metrics are translated to standalone SQL sources using window functions, while conversion metrics are not written as SL and instead produce a wiki note plus an emit_unmapped_fallback call.

How does the skill handle MetricFlow extends inheritance?

Inheritance is flattened before writing: walk the extends chain from the most-derived child, accumulate measures, dimensions, and entities, and emit one overlay named for the child. Name collisions resolve in favor of the child, with the overridden parent noted in the description.

Why does ktx reject columns after writing a semantic layer source?

The warehouse rejects invented columns with an Unrecognized name error during sl_validate. Every column must come from raw files, entity_details, or a successful sql_execution probe, never from assumptions or placeholder identifiers.