Repository navigation
Lightdash metrics in the generated dbt project, and release 1.14.0 - #48
Merged
Merged
Conversation
to_lightdash(semantic) writes the dbt model properties Lightdash reads (config.meta): joins along every path that is the only one, dimensions labelled and other columns hidden, simple metrics and row counts on their columns with filters in Lightdash's own grammar or a CASE WHEN where it cannot say them, ratios and derived metrics as type: number. What Lightdash has no place for is listed in the export's lossiness. write_lightdash merges it into a generated project's staging YAML. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tdash Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ightdash compile Every mapping and every loss has a unit test; every example's document validates against Lightdash's own JSON Schema for dbt YAML (vendored, MIT); the shipped examples with --lightdash must dbt parse cleanly and, when the Lightdash CLI is on PATH, compile every explore with --no-partial-compilation. Also writes '!null' once when ne and is_null: false both ask for it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Adds a Lightdash exporter beside the Ossie one, so a metrics file reaches Lightdash too.
What changes
generate --lightdashwrites the model's metrics, dimensions and joins into the generated dbt project:config.metaof each staging model's ownmodels/staging/stg_<table>.yml. The meta is merged in next to the tests, because dbt reads a model's properties from one file only.--metricsfile's, or without one the metrics the model implies.model2data metrics export --to lightdashwrites the same meta as one properties file, without generating.model2data.metrics.to_lightdashandwrite_lightdash, besideto_ossie.Mapping. Format chosen: the dbt YAML
metathat Lightdash documents as its default for dbt projects. Its MetricFlow support is beta, and Lightdash YAML is for projects without dbt.count_distinctof a one-column primary key;type: numbermetrics over${input}.ai_contextbecomesai_hint.percentandcurrencybecome'0.00%'and'#,##0.00'.filterswherever Lightdash's filter grammar means exactly the same, checked against its source, not only the docs;'!null'beside it, since Lightdash's lets nulls through;anygroup or a date comparison becomes aCASE WHENinsql, so the metric counts what its known value counts.Docs: https://docs.lightdash.com/references/metrics, /references/tables, /references/dimensions, /references/writing-descriptions, /integrations/dbt/metricflow.
Checked
lightdash.pyhas 100% coverage.lightdash-dbt-2.0.json, MIT, vendored with its licence).dbt parseis clean anddbt buildof the coffee example passes (79/79).@lightdash/cli2.177.0lightdash compile --no-partial-compilationsucceeds for every explore. The test runs only whenlightdashis on PATH, so CI skips it.--lightdash: I diffed origin/main against this branch on three runs: with metrics, with--days 2 --defects messy, and with--unit-tests.Not done
Release
pyproject.toml1.14.0 and the lock.🤖 Generated with Claude Code