Repository navigation
v1.14.0
Added
- Lightdash metrics in the generated dbt project.
generate --lightdashwrites the model's
metrics, dimensions and joins where Lightdash
reads them: underconfig.metaof each staging model's ownmodels/staging/stg_<table>.yml,
next to its tests (dbt reads a model's properties from one file only, so the meta is merged in
rather than written beside it). It takes the--metricsfile's metrics, or without one the
metrics the model implies. Each table is joined many-to-one to every table it reaches along
exactly one path; a dimension gets its label and a column that is not one is hidden; a simple
metric sits on its column, a row count is acount_distinctof the one-column primary key, and
a ratio or expression is atype: numbermetric over its inputs;ai_contextbecomes
ai_hint,percentandcurrencythe formats'0.00%'and'#,##0.00'. A filter becomes
the metric'sfilterswherever Lightdash's filter grammar means exactly the same (with
'!null'beside a not-equal, since Lightdash's lets nulls through), and aCASE WHENin its
sqlwhere it does not (ananygroup, a date comparison), so the metric counts what its
known value counts. What Lightdash has no place for (an enum's members, a table's role and
grain, a currency, a metric dated by another table's column, a ratio whose inputs are on two
tables, which is left out) is listed in the run's summary. Every example's output validates
against Lightdash's published JSON Schema for dbt YAML, parses with dbt, and compiles with
lightdash compile --no-partial-compilation. model2data metrics export --to lightdashwrites the same meta as one dbt properties file
for the staging models, without generating, the losses listed at its top.model2data.metrics.to_lightdashandwrite_lightdashin the Python API, beside
to_ossie.
Without --lightdash, a run writes byte for byte what 1.13.0 wrote, with or without
--metrics.