Skip to content

feat(dbt): emit Hex's semantic-model table binding - #20

Open
andrebaaij wants to merge 2 commits into
mainfrom
feat/dbt-hex-meta
Open

feat(dbt): emit Hex's semantic-model table binding#20
andrebaaij wants to merge 2 commits into
mainfrom
feat/dbt-hex-meta

Conversation

@andrebaaij

Copy link
Copy Markdown
Contributor

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:

option purpose
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.

- name: fct_orders
  config:
    meta:
      hex:
        table: ecomm.marts__fct_orders

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

schema defaulted to MAIN unconditionally, so the binding came out 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.

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

andrebaaij and others added 2 commits August 12, 2026 21:12
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant