feat(dbt): emit Hex's semantic-model table binding - #20
Open
andrebaaij wants to merge 2 commits into
Open
Conversation
Hex's Semantic Model Sync parses dbt MetricFlow YAML straight from a git repo
(not via an API), and binds each semantic model to a physical table through
`config.meta.hex.table`. Without that key the sync imports models that resolve to
nothing: the agent then answers about no data, which a benchmark grades as a
wrong answer rather than the setup failure it is. That exact failure mode cost a
full Lightdash run earlier.
Adds two options, both off by default:
table-prefix logical -> physical name (ClickHouse materialises fct_orders
as marts__fct_orders)
dbt-hex-meta emit the config.meta.hex.table binding
`dbt` becomes Configurable to receive them. A plain dbt build is unchanged and
carries no Hex key — asserted by a test, because the dbt target also writes the
shared ground-truth reference every arm reads, and one vendor's meta must not
leak into it.
Also fixes a defaulting bug this surfaced. `schema` defaulted to MAIN
unconditionally, so the binding came out as `ecomm.MAIN.marts__fct_orders`, which
does not resolve on ClickHouse's two-part namespace. `schema` is now a pointer so
an EXPLICIT empty value is distinguishable from an omitted one; omitted still
defaults to MAIN. Changing the default globally was the wrong fix: ossie,
nao-yaml, supersimple and the warehouse dialects all read Schema, and Snowflake
targets genuinely need the qualified form.
Verified against the pinned eval reference: 38 semantic models, 22 measures, 14
metrics, all 38 bound to ecomm.marts__<name>.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Schema *string change altered the struct's field-alignment column, which gofmt reflows. CI checks gofmt -l and I did not run it before pushing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Hex's Semantic Model Sync parses dbt MetricFlow YAML straight from a git repo (not via an API), and binds each semantic model to its physical table through
config.meta.hex.table. Without that key the sync imports models that resolve to nothing — the agent answers about no data, which a benchmark grades as a wrong answer rather than the setup failure it is. That exact failure mode cost a full Lightdash run.Changes
Two options, both off by default:
table-prefixfct_ordersasmarts__fct_orders)dbt-hex-metaconfig.meta.hex.tablebindingdbtbecomesConfigurableto receive them.A plain dbt build is unchanged and carries no Hex key, asserted by a test: the dbt target also writes the shared ground-truth reference every benchmark arm reads, and one vendor's meta must not leak into it.
Defaulting fix
schemadefaulted toMAINunconditionally, so the binding came outecomm.MAIN.marts__fct_orders, which does not resolve on ClickHouse's two-part namespace.schemais now a pointer so an explicit empty value is distinguishable from an omitted one; omitted still defaults toMAIN.Changing the default globally was the wrong fix — ossie, nao-yaml, supersimple and the warehouse dialects all read
Schema, and Snowflake targets genuinely need the qualified form.Verification
Against the pinned eval reference: 38 semantic models, 22 measures, 14 metrics, all 38 bound to
ecomm.marts__<name>.go test ./...green.🤖 Generated with Claude Code
https://claude.ai/code/session_01P1Ae794MJcezTixWn2wZ4J