Shape of the boundary
- A surface (SKILL.md or AGENTS.md) tells the agent which subcommand to run.
- A thin PEP 723 wrapper (
skills/<skill>/scripts/run.py) runs it viauv run --no-projectagainst the pinned engine version, installing the connector extra it resolves at runtime (an explicit--connector, then theconnector:in the.dex/config.ymlfound by walking up from the run directory to the git root, then DuckDB), so the pin stays connector-neutral.uvis therefore a prerequisite, and the wrapper holds the envelope contract even there: with nouvonPATHit refuses with areason: prerequisiteerror envelope naming the install command, rather than failing the exec. It is the one refusal built by hand, because the engine that would otherwise build it is what is missing. Two commands need more than a warehouse client, and both are resolved the same way, from the command being run rather than installed always:explore clusteradds[cluster], andexplore semanticadds[semantic-api]plus, where a statement might be rendered locally (any mode butlist, without--api),[semantic], and[slayer]wheresemantic.vendorisslayer, in place of[semantic], since SLayer renders its ownqueryandvalues.[cube]follows the samesemantic.vendorread for the same commands where the vendor iscube, is always taken bysemantic cube, and a Cubequeryorvaluesnever takes[semantic]either.[metric-views]follows the same read where the vendor isdatabricks, is always taken bysemantic databricks, and never takes[semantic].[semantic-views]follows the same read where the vendor issnowflake(also a connector name, whose extra still comes fromconnector:alone), is always taken bysemantic snowflake, and never takes[semantic]. A repo that runs neither resolves neither scikit-learn nor MetricFlow. - That environment is uv’s own, and
--no-projectis what keeps it so. Without it uv discovers whatever Python project the caller is standing in, builds it, leaves a.venv/and auv.lockin their repo, and puts their dependencies on the engine’s import path: unreviewed writes into a tree dex was asked only to read, and an engine no longer running against the closure it pinned. The invariant is asserted structurally on the commands the wrapper builds, in the safety spine. --warmis the wrapper’s own flag and the only one it answers itself, stripped before the argv reaches the engine. It resolves extras through the same path a real run does, installs them, prints one envelope naming what it installed, and exits without running a command. That is what lets a container build, a CI setup step, or a first-time install pay a cold resolution once instead of leaving it on an interactive caller’s clock, and resolving through the shared path is what keeps it from warming an environment the next command would contradict.- The engine prints exactly one sanitized JSON envelope to stdout and nothing
else. Diagnostics go to stderr. That includes an argv the parser refuses (a
missing argument, an unknown flag or command, a bad value): a
reason: requesterror envelope carrying the parser’s message, exit 1, with the usage on stderr. Only--helpand a baredexprint their own text, and exit 0. - Every envelope carries a constant
connectionblock. On success it names the resolved connector, its non-secret target coordinates, and the source of that resolution (flag,.dex/config.yml,environment variable,dbt profiles.yml, ordirectory-local inference). Commands that resolve no warehouse keep the same shape with null/empty fields. This includes the wrapper’s missing-uv refusal and warm-up responses: their connection fields are null/empty and all cost fields are null, because no warehouse was contacted or query priced. The block is assembled from facts already resolved by the command and never opens a connection or spends merely to describe one. DBT_PROFILES_DIRlocatesprofiles.ymlfor dbt operations and the last-resort credential fallback. It does not select dex’s connector or override--connector/--pathor.dex/config.yml; help and no-connector refusals say so explicitly.- The agent reads the envelope and decides the next step.
.dex/ cache, so
subcommands are stateless: the agent orchestrates multi-step flows by
re-reading them between calls. Credentials never cross this boundary, and nothing
reaches agent context except through the sanitized envelope: values cross only
from profiled, PII-cleared columns, bounded and capped by the query firewall.
Every errors and warnings entry is redacted as the envelope is printed
(key=value and key: value secrets, Bearer and Authorization: credentials,
query-string secrets, and URL passwords), since a message often quotes text dex
did not write.
The command surface
Capabilities, not final spelling. Implemented incrementally:demo, procedure, feedback, connect test,
the config group, the explore group, the authoring surface (transform,
semantic), and the maintain group are live.
How authored content reaches the engine
The engine has no model of its own; the agent authors the dbt file content and hands it over via--edits-file <path> (or - for stdin), a JSON payload:
edits, transform plan and semantic define|update|plan accept a
declarations list: per model, what one row is, which rows are in, what each column
is, and the assumptions the model rests on with their evidence. Each is rendered
into the model’s existing YAML entry as a schema_yml edit in the same plan, and
edits may be omitted when the payload only declares models that exist. The plan,
apply and build envelopes then carry data.decisions, every assumption declared on
the models the command touched. The plan envelope also carries
data.declarations.<model> for every model the plan creates, edits or declares:
drafted (facts the .dex/ cache and the SQL support, each with its evidence),
declared (what the post-change YAML says) and missing (intent fields nobody
supplied, each also a warning). For measures, warnings name only the missing
aggregation, additivity, or unit fields and group columns with the same
missing fields; the missing list keeps its per-column paths unchanged.
drafted.precedent says what the project’s other models do with each column
that the model filters, branches on or aggregates; drafted.population_parent
is the parent dex drafts for a model that declares none (a unique key equal to
the grain, a relationships edge, the description’s “one row per” noun, the
driving relation, strongest first), labelled drafted with its evidence and
never written, with transform build --verify measuring the model against it
(#1228); and a
literal compared to a column whose complete cached domain does not hold it is a
warning. On a model that already exists, contradictions lists each declared rule
(population filter, grain, declared column, an upstream column’s additivity) that
the edit and the post-change declaration disagree on, each also a warning naming
the side that looks stale and both fixes; it never refuses. It reads the cache and
the repository only and opens no connection; a contradicted population cites the
delta row attribution measured, and measures nothing of its own. A model under
transform.marts_paths (default [models/marts]) whose post-change YAML carries a
declaration also gets data.semantic_proposal: the semantic definition the
declaration states in the configured layer, through the one per-vendor derivation
hook (SemanticDerivationSource), with vendor naming which. Under dbt it is a
MetricFlow semantic model (primary entity from a single-column grain, foreign
entities, categorical and time dimensions, measures with their declared
aggregation, and non_additive_dimension for a semi_additive measure), with every
gap named rather than guessed and no metric ever derived. In a project with a dbt
semantic layer (a semantic model and a time spine) a derivation that passes
MetricFlow’s schemas, the metric-input check and dbt’s parse of a throwaway copy is
added to the same plan; in one without, nothing is added and the object is ready to
pass to semantic plan --definitions-file. The parse is never skipped for a
derivation, whatever --no-parse says. Under slayer it is a SLayer model file
(primary_key from the grain, many_to_one joins from foreign keys, saved
measures <column>_<agg>), validated by semantic slayer’s own checks and read
back through its catalog, then stored as a second plan on the SLayer layer
(plan_id, beside the dbt plan; apply both) where its path is already under
semantic.slayer.models, and proposed with the dex config set that adopts it
otherwise. Under cube it is a Cube model file of its own, <dir>/<mart>.yml
beside the configured files (primary_key on the grain dimensions, other roles as
dimensions, declared aggregations as measures named after the column,
many_to_one joins from foreign keys), validated by semantic cube’s own checks
and read back through its catalog, and included or proposed on the same terms
against semantic.cube.files. Under databricks it is a Metric View file of its
own, <dir>/<mart>.yaml (the mart as source, other roles as fields with a
date/date_time format on temporal columns, declared aggregations as measures
<column>_<agg> with a currency or percentage format from the unit, many_to_one
joins from foreign keys with rely.at_most_one_match only where the parent
declares that key as its grain), validated by semantic databricks’s own checks,
read back through its catalog, and included or proposed on the same terms against
semantic.databricks.files; a Metric View has no metadata key, so the population
is only the last sentence of its comment. Under snowflake it is a logical
table (the mart as a three-part base_table, primary_key from the grain, a
time role as a time dimension and other roles as dimensions, each measure a fact
with declared aggregations as metrics <column>_<agg>, non_additive_dimensions
for a semi_additive one, and a relationship from each foreign key to a parent
table keyed on that column) spliced into the configured file holding the tables
its foreign keys reference and stored as a second plan (plan_id), or a view of
its own, <dir>/<mart>.yaml, included or proposed against
semantic.snowflake.files; a Semantic View has no metadata key, so the
population is only the last sentence of the table’s description. Under ossie it is a dataset (a field per declared
column, primary_key on every grain field, declared aggregations as dataset-scoped
metrics <column>_<agg>, a relationship from each foreign key to the parent’s
field) appended to the configured document holding the datasets its foreign keys
reference, every other byte kept, and stored as a second plan (plan_id); where
no configured document can hold it, it is proposed as a document of its own. In
every layer a population is carried as metadata (config.meta.dex, meta.dex, or
Ossie’s ai_context, and one sentence in the description)
and never as a filter, since the mart’s SQL already enforces it; per model,
carried and not_carried account for every declared field.
semantic slayer define|update|plan, semantic cube define|update|plan,
semantic ossie define|update|plan, semantic databricks define|update|plan and
semantic snowflake define|update|plan take declarations too, annotating a
model, cube, dataset, view or logical table the payload or the layer defines. A command that takes no declarations refuses a payload
carrying them rather than dropping them. A version of a native dbt versioned
model is declared as "model": "dim_teams.v2" and renders into that item of the
model’s versions: list, every other byte kept (#895); the bare name is the
shared entry every version inherits, a version’s file stem is refused naming the
label, a model-level fact stated at the other level is refused (dbt concatenates
a version’s lists into the shared entry’s), and a fact about an inherited column
is written as dbt’s override, the column excluded from the version and declared
as its own entry with the inherited tests carried over. transform declare [<model>...] takes the
same payload for models that already exist: it proposes only the measured facts
each selected model does not yet declare, lays the supplied declarations over
them field by field, and stores the lot as one capped plan, naming every model it
skipped and why. The full shape, the refusals and
what each field renders into:
skills/transform/references/declarations.md.
kind is one of model_sql, schema_yml, semantic_yml (optional on
semantic define|update, which imply semantic_yml), packages_yml,
macro_sql, snapshot_sql, seed_csv, test_sql, analysis_sql,
project_yml, profiles_yml, or semantic_document (optional on semantic ossie define|update|plan). Each edit also has an op:
upsert (create or update, the default, carrying content) or delete (remove
the file, no content). A delete is a reviewable diff pinned to the file’s hash
like any other edit, and it is guarded: the plan is refused if any surviving file
still ref()s a deleted model (the offenders are named, with the line). Deleting a
project override of a package model is the exception: where an installed package
defines a model of that name and the project’s dbt_project.yml after the plan
leaves it enabled, a one-argument ref() (or one naming that package) resolves to
the package’s model and does not dangle (#1083). So the
post-deletion project is proven free of dangling references before the plan is
stored, and, when dbt is available, the same post-deletion tree is confirmed by
dbt’s parser. The guard reads the reference index behind transform references,
which is why it sees the two-argument ref('package', 'model') form, why a seed’s
data rows no longer count as source, and why a reference dex could not resolve
statically warns rather than refusing: it may or may not name the deleted node,
and no edit the caller could make would settle it.
Control-flow model compilation requires dbt and a dev profile. Dex compiles a
throwaway copy containing every proposed edit, validates fresh SQL, and keeps the
original Jinja in the stored plan. Compile-time SELECTs are governed through
Dex’s query path. adapter.get_columns_in_relation, which dbt_utils.star and
Fivetran’s fill_staging_columns call, is answered from Dex’s scoped metadata
(names and types, no rows) and counts toward query.max_statements; a raw
DESCRIBE, SUMMARIZE or information_schema read stays refused, naming that
method. Direct warehouse handles and other adapter introspection refuse. Dynamic queries share the command ceiling, with partial estimates and
completed spend disclosed. See dbt projects
and cost controls.
A rename is one plan: delete the old model, create the new, update the
referrers, validated together. transform rename generates exactly that plan, and
the rest of the rename’s edits with it, so hand-assembling one is now the fallback
rather than the route. Note the two guards read the same index and answer
differently on purpose: a reference dex cannot resolve warns on a delete and
refuses on a rename. A dangling dynamic ref left by a delete is unsatisfiable,
so refusing would block a legitimate delete forever; the same reference in a
rename’s path is satisfiable, because the caller can resolve it by hand and
re-run. The engine validates each edit
(model SQL must be a single read-only SELECT, checked on fresh dbt-compiled SQL
for Jinja for/if control flow and with Jinja stripped otherwise; YAML must
parse; semantic YAML must satisfy MetricFlow’s schemas; a packages_yml edit
must carry a packages: or dependencies: list and targets the project-root
packages.yml or dependencies.yml; a macro_sql edit must hold only macro
definitions and jinja comments and must target the project’s macro paths, where
no other kind may go; a snapshot_sql edit must hold exactly one
{% snapshot %} block whose config() names a unique_key and a strategy of
timestamp (with updated_at) or check (with check_cols), whose body is a
single read-only SELECT, and must target the project’s snapshot paths; a
seed_csv edit must parse as CSV with a named, duplicate-free header and one
field per column on every row, must stay under 5,000 data rows and 1 MiB, must
not name columns that look like personal data, and must target the project’s
seed paths; a test_sql edit must target the project’s test paths and must be
either a generic test definition (only {% test %} blocks and jinja comments,
balanced) or a singular test that is a single read-only SELECT once its jinja is
stripped; an analysis_sql edit must target the project’s analysis paths and be
a single read-only SELECT on the same terms; a project_yml edit targets the
project-root
dbt_project.yml and must keep a name; a profiles_yml edit targets the
project-root profiles.yml and must reference every secret via
{{ env_var('NAME') }}, never a literal), pins it to the sha256 of the file it
would change, computes the diffs, and stores the plan under
.dex/plans/<plan-id>.json. Nothing touches the dbt project until an apply.
packages_yml is the guarded way to declare dbt package dependencies: a
reviewable diff like any other edit, then transform deps (or the automatic
deps step in transform build) installs them. A plan installs nothing, and dbt
cannot parse or compile a tree whose declared packages are not installed, so a
plan that needs dbt’s parse or a control-flow compile is refused, naming each
missing package and transform deps. The check reads the post-edit tree
(#1166): a package the plan’s own packages_yml edit declares is refused the
same way, with the route spelled out (the packages_yml edit as a plan of its
own, applied, transform deps, then the rest); a packages_yml-only plan needs
no parse and is stored. --no-parse (DexEngine.plan(..., no_parse=True),
#1517) stores a plan without starting dbt at all, for a host that must not run
repository-controlled code (Jinja, macros, project hooks) where it authors: it
skips the parse gate (a warning says so, and data.model_versions reads
unchecked with parse_skipped), the parse of a declared mart’s derivation
(reported unvalidated under data.semantic_proposal, left out of the
plan and offered under its definitions for semantic plan where dbt parses), compilation, and the package check that protects them. Every structural
gate still runs: admission and placement, deletions, the PII and secret guards,
hash pinning and the diffs. A model with Jinja control flow is refused with the
error a missing compile raises, since nothing else can check it; a model that
only lists columns through a macro is checked from its SQL, as where dbt is
absent, with a warning naming it; and a toggle contract, whose check compiles
every model, is refused. The caller parses the post-change project elsewhere,
for example a transform build --for-plan-file in its sandbox. Installing the packages a project
declares (at the versions package-lock.yml pins, where it matches) is not
installing or upgrading a tool. macro_sql is how a macro is
repaired or customized by hand; transform macro <name> is the scaffolding path
for the macros dex ships. snapshot_sql and seed_csv bring slowly-changing
dimension capture and small reference tables into the same flow, each confined to
its own path family (snapshot-paths and seed-paths in dbt_project.yml, read
with dbt’s own defaults) and each gated by dbt’s parser at plan time. A
schema_yml edit is accepted beside either one, which is where dbt expects a
seed’s column types and a snapshot’s tests and docs to be declared. dbt build
runs seeds and snapshots natively, so nothing new has to be run after an apply;
a snapshot writes a table and is priced in the cost handshake, while a seed
loads a local CSV, scans nothing, and is deliberately unpriced.
test_sql and analysis_sql do the same for the two remaining families
(test-paths and analysis-paths, again with dbt’s defaults). A singular test
is an arbitrary SELECT that must return no rows, which is where most
project-specific assertions live, and generic test definitions share the same
directory, so test_sql reads the file to tell them apart: a {% test %} block
is checked structurally like a macro, anything else is checked like a model. A
singular test naming no ref() or source() warns rather than refuses, since it
runs against nothing and passes unconditionally. An analysis is held to the same
read-only SELECT even though dbt only ever compiles it, because read-only against
data describes what dex writes rather than what dbt runs. schema_yml is
accepted beside each. Neither kind builds a relation and nothing can ref()
either, so neither is a node: neither enters the drift baseline, and deleting one
raises no dangling-reference guard. dbt build runs a singular test natively and
prices it like any other test; an analysis is compiled by dbt compile, never
built, and costs nothing.
Three different things here are called a test. Generic tests are declared
inside a schema.yml (data_tests: on a model or a column). Unit tests are
scaffolded by transform test --scaffold <model> into a unit_tests: block,
also schema_yml. Singular tests and generic test definitions are files under
test-paths, and those are what test_sql authors. transform test --mutate
measures all three together, because dbt runs all three and a defect only has to
get past every one of them to ship.
transform test --mutate <model>: what the tests are worth
A passing suite says the tests ran. It does not say they would notice if the
model were wrong, and no count of tests distinguishes the two. This plants one
defect at a time in the model’s compiled SQL and reports which ones nothing
caught.
The defect classes are the ones that recur in analytics code: a boundary
comparison flipped to include or exclude its edge, a WHERE predicate dropped or
negated, an inner join swapped for a left join or the reverse, a CASE branch
removed, a ratio inverted, a window frame bound shifted by one, and sum
swapped with max.
A window frame’s first constant bound moves one step wider. A ROWS bound counts
rows; a numeric RANGE bound counts units of the ordering value, and its defect
says so. An interval bound (RANGE BETWEEN INTERVAL '6 day' PRECEDING) gets two
mutants, one unit wider and one unit narrower, because a calendar window asks two
boundary questions: does the first day it should exclude leak in, and is the last
day it should include still counted. Only the quantity changes; the unit is kept as
written. Each window mutant carries frame (kind, side, unit, from, to,
last_included, first_excluded), and an interval survivor’s suggested_test
names the two days a fixture needs rows on, with a gap in the dates so a row-count
frame cannot give the same answer (#1112). Every bound no mutant moved is listed in
data.unsupported_sites with a reason_code (non_literal_offset,
fractional_offset, compound_interval, string_offset, negative_offset,
unknown_unit, other_bound_of_mutated_frame), with a warning, and is never
counted toward the cap: its boundary is untested by the run. UNBOUNDED and
CURRENT ROW have no offset and are not listed. A model whose only mutable SQL is
such a bound is refused, naming it. Each finding is written as the defect rather than as a diff,
and carries suggested_test, because the reader’s next action is to write a
test.
A versioned model. Each version is its own model, with its own SQL, tests and
record, so a run measures one. <model>.v<N>, the label transform declare
takes, names that version (#1374). The bare name measures the version an
unversioned ref('<model>') resolves to (its latest_version, else the greatest
version), with a warning, and data.model is always the label of the version
measured. A version the model does not list, a label on a model with no versions,
and a version’s file stem (<model>_v<N>) are refused for free, the last naming
the label. --downstream routes each mutant to the models that ref() the version
measured, never to readers of another version.
Where a mutant lives. In a throwaway copy of the project, and nowhere else.
Each one is written with materialized='ephemeral', so dbt inlines it into each
test as a CTE and materializes nothing: no relation is created, replaced or
dropped, and there is nothing to clean up afterwards. The run uses dbt test
rather than dbt build, which is what keeps a failing unit test from skipping
the model and cascading that skip onto every data test attached to it. The
on-run-start and on-run-end hooks of the project and of every installed
package are stripped from the copy, since dbt is invoked once per mutant and a
hook that grants, audits or uploads should not fire N+1 times; a note names
whose hooks went. A package an absolute or far-climbing packages-install-path
puts outside the project is not in the copy, so its hooks cannot be stripped,
and a run where one declares a hook is refused. Where the Elementary package is
installed, the copy also disables its models unless something outside the
package refers to one, and leaves its monitoring tests (anomaly tests,
schema_changes and the others that check the package is enabled, and a
project’s own test that wraps one of them) out of every run. Where its models must stay
enabled, the copy sets require_explicit_package_overrides_for_builtin_materializations
so the tests run under dbt’s own test materialization, since Elementary’s needs
the hooks that were stripped; where a test materialization in the project still
hands them to Elementary’s, the run is refused. Either way Elementary’s
materialization handles no test: with the package disabled it hands each one
straight to dbt’s, and with the flag set dbt never picks it, so none of its temp
tables or samples are written (#1307).
What the verdicts mean. killed is a defect at least one test caught, named
in caught_by. survived is one nothing caught. rejected is one the warehouse
refused outright, kept separate because a build would have failed on it anyway
and counting it as caught would flatter the suite. not_run is a mutant the
budget stopped. Every verdict is relative to the tests that passed against the
unmutated model, and any test that did not is listed in baseline.excluded with
the reason, so a suite measured against its own broken tests cannot read as
clean. An Elementary monitoring test kept out of the run is listed there too,
with status not_run and a reason_code: elementary_disabled where the copy
disabled the package and the test would check nothing, elementary_history
where the package stays enabled and the test would read and write its history. A run where nothing passes at baseline is an error, not a clean sweep.
Equivalent on the dev data. A survivor is not always a gap in the
assertions. Some mutants produce exactly the model’s rows on the data the dev
target holds (an inner join where every key resolves, a window frame no
partition is long enough to reach), and no test over that data could tell them
apart. So each survivor is compared with the unmutated model on the dev target,
and equivalence on the mutant carries the answer: status, then
only_in_mutant and only_in_baseline (rows one side has that the other does
not, counted as a multiset, so duplicated rows count), and mutant_rows and
baseline_rows. Counts only; no row value leaves the warehouse. equivalent
means both difference counts are zero, so only a unit test fixture that reaches
the case can catch it. distinguishable means the data already differs, so an
assertion over that data would catch it today. Distinguishable survivors are
listed first, then any that could not be compared, then equivalent ones, and
suggested_test follows the label: a fixture for an equivalent survivor, an
assertion for a distinguishable one. not_checked carries a reason. An
equivalent survivor is still survived and still counts in score, since a
fixture can catch it.
Before any survivor is compared, the unmutated model is compared with itself.
A model that does not reproduce its own output (a random(), a uuid, a
row_number() over ties) would make every mutant look different from it, so in
that case no survivor is labelled and data.equivalence.self_check says
not_reproducible. data.equivalence also reports checked, the
distinguishable, equivalent and not_checked counts, and a reason when
the comparison did not run. The comparison is free and automatic on DuckDB. On
BigQuery and Snowflake it is opt-in, with --check-equivalence, because it is
spend; --no-check-equivalence turns it off anywhere. Other connectors report
survivors as not_checked until dex has a verified whole-row comparison for
them.
Cost. Free on DuckDB. On a metered connector each mutant is priced as the
statements the warehouse will actually run, by splicing it into each test’s
compiled SQL, because a mutant that drops a partition predicate scans more than
the model it came from. The whole batch is one estimate and one confirmation:
per_table_bytes names (baseline) and each mutant, so the caller sees the
total and the breakdown before anything executes. With --check-equivalence,
two more lines join the same estimate: (equivalence self-check) and
(equivalence checks, if every mutant survives). The checks are priced as if
every mutant survives, because the suite’s strength is not known until the run,
so the settled spend is at most that line. If the confirmed budget runs out
partway, the run stops and the remaining mutants are reported not_run rather
than the budget being exceeded. Spend settles per run under
command: "transform test" in the ledger, each comparison included.
The cap. 20 mutants, and --max-mutants may only lower it. Mutants are
ordered round robin across the defect classes, so a capped run on a model with
forty comparisons and one join still tests the join; what the cap cut is reported
in data.cap.elided, per class.
Downstream tests. A defect ships only if every test in the project misses it,
and the tests that pin what an intermediate model feeds are often on the mart that
reads it. --downstream runs those too. Each model downstream of the mutated one
that can carry the mutant is made ephemeral in the same throwaway copy, so dbt
inlines the whole chain into each of its tests, mutant at the bottom, and still
nothing is materialized. The walk is breadth first through the manifest, nearest
models first, capped at 50; it stops on each branch at a node that cannot be made
ephemeral (a snapshot, a Python model, a package’s model, a model with a
sql_header), since below it every relation still holds the unmutated rows.
data.downstream.cut names each such node and why, and elided counts what the
cap left out.
Which downstream tests run: the generic and singular tests on the routed models,
listed in data.downstream.tests. Two kinds are excluded, each named in
data.downstream.excluded with its reason: a unit test on a downstream model,
which reads its fixtures and never the mutant, and a test that also reads a
downstream relation the mutant cannot reach, which would compare the mutant with
the unmutated model and report a catch that a real change would not produce. The
model’s own tests are never excluded.
A defect only downstream tests caught is caught_downstream, with the tests in
caught_downstream_by; caught_by stays the model’s own tests, and a killed
mutant also carries caught_downstream_by when a downstream test caught it too.
score counts a caught_downstream defect as a miss, because it answers for the
model’s own suite and means exactly what it meant before downstream tests ran.
score_with_downstream counts it as caught, and is null when the downstream tests
did not run. data.counts.caught_downstream is always present, zero when off.
Equivalence checks run only for true survivors.
On by default on DuckDB, where it is free. Elsewhere each downstream test
recomputes the chain beneath it, so it is opt-in with --downstream, priced into
the same single estimate (each mutant’s line grows by the downstream tests it
will run) and confirmed once; --no-downstream turns it off anywhere. When it is
off, data.downstream.reason says why: not asked for on a metered connector, no
model reads this one, the models that read it have no data test that can see the
mutant, or the routed models would not compile as ephemeral, in which case every
file is put back and only the model’s own tests run. A model with no tests of its
own is measurable when downstream tests read it.
The incremental branch. An incremental model is two programs, and a mutant
builds ephemeral, so is_incremental() renders false and the
{% if is_incremental() %} branch is not in the SQL the full build’s mutants come
from (#1132). The model is compiled a second time with the branch taken and
{{ this }} kept as {{ this }}, and its comparisons and filters that the full
build does not also have are planted there: a flipped boundary, a dropped filter
and a negated one. A site both programs share is the full build’s. Only the unit
tests that override is_incremental to true run the branch, so those, and nothing
else, run against its mutants, and the full build’s runs leave them out.
data.incremental holds the branch: tests (those unit tests), baseline,
mutants (ids i01…), counts, score, cap (its share) and a reason
when nothing ran against it. With no such test, every branch mutant is
survived without a run, reason says why, and suggested_test names a unit test
with the override and a this fixture. A branch survivor’s equivalence is
not_checked, since the branch reads {{ this }}. data.score and
data.counts stay the full build’s, so neither score mixes the two programs;
data.cap is the whole run’s, and one cap binds both, with the branch’s classes
beside the full build’s in the round robin. A model whose only mutable SQL is the
branch is measured rather than refused. A model whose only tests override
is_incremental runs no full-build mutant: each survives by construction, with
a warning. data.incremental is null for a model with no branch, and a model that
is not materialized incremental has none, since dbt never runs it.
seed_csv is the first kind that puts values, not logic, into a reviewable
diff, and a diff goes into git and stays there. So a seed’s header is checked
both against the PII detector explore profiles warehouse columns with and
against the flags already in the .dex/ cache. A column at or above the
blocking threshold is refused, and the refusal names the pii_overrides entry
that would clear it, never a value (pii-policy.md). On a seed
file the plan creates, a column whose strongest flag is exactly at the threshold
and comes from its header name alone warns with that entry instead, since the
plan authored it; a column a profile flagged, a rewrite of an existing seed, and
any stronger flag still refuse. The
standing limit is worth knowing: dex detects PII from names and types and never
from values, everywhere, so a seed column named code full of email addresses
passes this gate.
project_yml and profiles_yml bring the two
project-root config files into the same plan/diff/apply flow; because they carry
project-wide settings and connection targets, they are gated by dbt’s own parser
at plan time, and a profiles_yml edit is refused if it (or the file it would
replace) inlines a literal credential, so no secret ever reaches the diff. A
key reads as a credential when its name contains one (db_password,
jwt_token), and its value is safe only when the whole value is one
{{ env_var('NAME') }} reference, with an empty default at most
({{ env_var('NAME', '') }}): a literal beside the reference, a non-empty
default, or a filter or operator after it is refused. A key naming a location
(private_key_path, token_uri) holds no secret and is exempt.
-
transform init "<name>" --connector <duckdb|snowflake|bigquery|databricks|postgres>bootstraps a dbt project when none exists:dbt_project.yml,models/staging/andmodels/marts/, and a project-localprofiles.ymlwith a singledevtarget wired to the warehouse dex already knows (--path, orduckdb.pathin.dex/config.yml). The profile is written owner-only (0600), as is anyprofiles.ymla later apply rewrites: dex renders onlyenv_var()references and key paths into it, but it is the file a password gets pasted into. It is strictly additive (any existing dbt project is a refusal, so nothing is ever overwritten), and everything created is reported ascreatediffs. Init never defaults the connector: the DuckDB on-ramp a read-only command may take (an explicit--path, or a committed config that omitsconnector:) is wrong here, because init bakes the connector into the generated profile.--connectorwins, aconnector:already committed in.dex/config.ymlis accepted (the envelope names which source was used), and bare init is an error listing the valid connectors. On success init writesconnector,dbt_project_dir, anddbt_target: devback to.dex/config.yml, so the choice is made once and is ambient for every later command. Every connector renders: DuckDB, BigQuery, Snowflake, Databricks, Postgres, and Redshift. On BigQuery,--project <id>names the project explicitly: it wins over a configured or discovered one, and init writes the same value tobigquery.project.--layered-schemasopts into per-layer schema routing: init additionally scaffoldsmodels/intermediate/, the shippedgenerate_schema_namemacro override, and amodels:block with+schema: staging|intermediate|marts. The override composes<custom schema>_<target name>(layer first, target last), so a dev build lands instaging_dev/intermediate_dev/marts_dev; a model with no custom schema falls back totarget.schema. On BigQuery the layer namespaces are sibling datasets in the profile’s project; on Snowflake and Databricks they are sibling schemas inside the dev database/catalog; on Postgres and Redshift sibling schemas in the database; on DuckDB schemas inside the target file. The same macro is available to existing projects viatransform macro generate_schema_name. Init also runs a content preflight over every namespace the new project would build into (the base dev namespace, plus each layer namespace when--layered-schemasis on): a free, metadata-only listing on every connector (never a query, never a warehouse wake-up). A namespace that already exists with tables or views produces a warning naming it, the object count, and up to five object names, because a later build would write alongside that content and replace same-named relations; init is the one point where the name is still trivial to change. It is advisory by design: init still succeeds, an empty or absent namespace stays silent, and when dex cannot open a connection the check degrades to a single note (init is credential-optional and stays that way). DuckDB’s base namespace is exempt, since the dev target is the same file as the source warehouse; only the layer schemas are probed there. -
transform planalso accepts--scaffold <table>(repeatable): a deterministic staging skeleton (stg_<table>.sqlplus per-model YAML with key tests underdata_tests:and PII flags in model and columnconfig.meta) generated from the.dex/cache. -
transform planleaves out an edit whose content is identical to the file already on disk (#1415): it is not in the diffs,data.paths, the comparison offer ortransform compare’s seed and snapshot check, and one warning counts and names the skipped files (“N edits match the tree and were skipped: …”). A payload builder can resend a whole feature without its unchanged files raising obligations. A declaration whose rendered YAML is already the file is skipped the same way. A payload whose every edit matches the tree, declarations included, stores no plan:data.plan_idanddata.plan_pathare null and a note says so, as ontransform declare. Identical is apply’s own no-op test (the file read as text), so a CRLF checkout resending LF content is skipped too. A delete is never skipped, and neither is a model file the payload’sdeclarationsname: resending a model’s SQL beside its declaration keeps the model in the plan, where a--for-planbuild verifies it. -
transform planstamps a model it creates with the PII metadata of each flagged input column it carries through (config.meta.contains_piiandpii_category, with or without a declaration), and reports every judged column underdata.pii_metadata(#1100): a measuring aggregate ismeasured, a constant standing in for a flagged columnredacted, a hash or other expressionunresolvedwith a warning, a hand-written markkept(or adisagreement), and a model that already existsnot_written. The rule and the precedence:pii-policy.md. -
A declaration renders the built-in tests (
unique,not_null,relationships) always, and Dex’s generated tests only wheredeclarations.render_testsin.dex/config.ymlturns them on (#1449):falseby default,truefor every kind this release renders, or a list of test names and cadences. Each generated test carries a dbt tag fixed per kind,dex_every_runordex_scheduled, so an orchestrator selects them with--select tag:dex_scheduledor leaves them out with--exclude. The plan lists each one underdata.generated_tests(model,column,test,cadence,claim, avariantwhere one kind renders several tests on one model, and astatusofadded,already_listed,not_renderedwith itsreason, orlisted_while_off). Turning the switch off removes no test already written. A list entry this release does not render is a non-fatalunknown_test_kindconfig problem. Each kind states the connectors it supports (every onemaintain verifyruns its matching check on); elsewhere it renders nothing and isnot_renderedwithreason: dialect_unsupported(#1451). This release rendersdex_unique_combinationfor a declared grain of two or more columns (#1452), on every connector: itsfailurescount equalsgrain_broken’sduplicate_count, a NULL grain value counts as a value, and the test returns that count and never a key. It rendersdex_population_filter(#1453) under the column of eachpopulation.filterslist, one test perincludesorexcludeslist, on every connector: itsfailurescount equalspopulation_contradicted’scontradicting_rows, a NULL breaks anincludeslist and never anexcludesone, values compare as text where any value or the column is text, and the test returns that count and never a value. A filter on a column the model’s SQL provably does not output renders nothing,not_renderedwithreason: column_not_output.maintain verifyjudges a filter stating both lists as two rules, one per list. It rendersdex_parent_population(#1454) on the model entry twice per declaredpopulation.parent, one test perdirection, taggeddex_scheduled, on every connector:missingfails withparent_population_missing’smissing_parentsandunexpectedwithparent_population_unexpected’sunexpected_keys, both counting distinct non-NULL keys. The parent is an argument written as aref(), and the declaration’spopulation.filtersscope the eligible parents of themissingtest asmaintain verifyscopes them: a filter whose column the parent lacks is skipped (where verify lowers its finding to medium, the test fails with the same count). A model-level test whose grain or key columns the model provably does not output renders nothing,column_not_output. It rendersdex_unit_range(#1455) under each column declaredunit: fraction, taggeddex_every_run, on every connector: it fails with the count of non-NULL values below 0 or above 1, which equalsunit_out_of_range’sout_of_range_rows(a field the fraction finding now carries), a NULL never counts, a column holding only NULLs passes wheremaintain verifynotes it unchecked, and a column that is not a number (text, a boolean, a date or time) is checked by neither. A column declaredunit: percentrenders nothing,not_renderedwithreason: heuristic_only, becausemaintain verify’s percent rule (every value within 0 to 1) is a question correct small percentages also raise. It rendersdex_join_coverage(#1456) on the model entry for each INNER join areferencesrequires (a key column declaring areferencesthat names the joined model, read bymaintain verify’s ownjoin_policy), taggeddex_scheduled, on every connector: the plan reads the join from the model’s SQL as it leaves it (eachref()andsource()standing for its relation) and writes its inputs as arguments,child/child_columns,parent/parent_columns, and thechild_where/parent_wherefilters the model applies before joining, in the connector’s dialect; itsfailurescount equals the join contract’sunmatched_rows, a NULL key is left out unless the key column is declarednull_rule: never(null_keys: unmatched), a duplicated parent key multiplies nothing, and the test returns that count and never a key. A required LEFT join to a parent the model filters first renders it too, sincerelationshipsreads the whole parent; one to the whole parent renders nothing,not_renderedwithreason: covered_by_builtin; a key conversion, a grouped side, a RIGHT or FULL join, a side that is noref()orsource()or a filter that does not transpile isjoin_shape_unsupported; SQL holding other Jinja, or not parsing, isjoin_unread, once per declaredreferences; and a listeddex_join_coveragewhose join the SQL no longer writes is reportedstale(reason: join_not_in_model) with a warning, and never removed. It rendersdex_referenced_key(#1457) under each parent column areferencesnames, in the parent’s YAML entry, taggeddex_every_run, on every connector: the references read are every one in the project as the plan leaves it whose child or parent the plan declares, one test per parent column however many children name it, itsdata.generated_testsrow carrying the parent asmodeland the children underreferenced_by. It fails with the count of rows repeating a non-NULL key (rows beyond the first of each), NULLs being no key, and returns that count and never a key. A parent whose declared grain is exactly that column, or whose column already listsunique, renders nothing,covered_by_builtin; a project model with nomodels:entry, a seed or a snapshot renders nothing,parent_undeclared(Dex does not create an entry to hold a test); a package’s model, or an override its package documents, renders nothing,parent_in_package.maintain verifyholds the same fact only through its consequence,row_fanouton a child joining the parent, which has other causes, so the parity harness holds the two in that direction alone.transform declare <parent>proposes the test where the parent owes nothing else. It rendersdex_temporal_contract(#1458) for each measure a declaredhistorynames, a model-level test taggeddex_scheduledon every connector, itsdata.generated_testsrow naming the measure asvariant: it fails with the count of entities whose column disagrees with the value the snapshot’s versions and the declared policy give, derived and excluded asmaintain verifyderives and excludes them, so each count is themismatched_entitiesof onetemporal_*_mismatchfinding, and returns that count and never a key. A measure verify would leave unchecked renders nothing, with verify’s reason, in verify’s order:snapshot_not_ancestor(the model’sref()lineage as the plan leaves it does not reach the snapshot),lineage_unavailable(an unresolvedref(), a macro that may read a relation, or a node the graph cannot read),hard_delete_records(the snapshot’shard_deletes: new_record, from itsconfig(), YAML entry ordbt_project.yml),snapshot_config_unread(the plan’s own reason: that config, orsnapshot_meta_column_names, is an expression), thenpolicy_missing;column_not_outputas for every kind. Thepopulationandtime_provenanceassertions render no test. It rendersdex_freshness(#1460) under each column declaringfreshness(the column with roletime), taggeddex_every_run, on every connector, withmax_lag_secondsas its one argument and the basis as itsdata.generated_testsvariant(part of the claim, not an argument): it fails with one row when the column’s newest value trails the warehouse’s clock by more than the lag, or when the column holds no value (an empty model, a column NULL on every row). It counts the rows within the limit, never computing the newest value or the lag, and returns1and the limit, so dbt’sfailuresequalsfreshness_exceeded’sstale.maintain verifyreports the lag in seconds, except on a column that looks like personal data, which it judges by the same count with the lag withheld (lag_withheld). Both sides read the warehouse’s clock in one statement, as whole epoch seconds with a timestamp carrying no time zone read as UTC, so a value exactly at the limit passes; a column that is no date or timestamp errors the test and isunchecked(not_temporal) inmaintain verify. A listeddex_freshnesswhose claim the column’s declared freshness no longer gives (itsmax_lagchanged, or was dropped for adeadline, which renders nodex_freshness) is retired (#1551): the sameschema_ymledit that renders its replacement removes it,status: retiredwithreplaced_bynaming the new claim, where it is exactly as Dex rendered it (claim and nothing else) and the replacement is listed. Otherwise it isstale,reason: freshness_changed, with a warning andkept(customized,no_replacement,shared_yaml,unspliceable), and stays; a change ofbasisalone keeps the listed test, which behaves the same. It rendersdex_continuity(#1461) under each column declaringcontinuity(the column with roletime,{grain, by};grainone ofsecond,minute,hour,day,week,month,quarter,year, defaultday,weekthe ISO week;bykey columns, default none), taggeddex_scheduled, on every connector, withgrainandbyas its arguments and the grain as itsvariant: it fails with the number of gaps, a gap being a run of buckets at the grain holding no row between two buckets holding rows, per value of thebycolumns, and returns that count and never a date or a key. An edge is never a gap. Each value is bucketed in UTC from its whole epoch seconds (calendar grains through its UTC day’s civil date), with no date spine; a column that is no date or timestamp, and a grain finer than a day on a date, error the test. It has nomaintain verifytwin: the parity harness holds it to fixture pairs stating the exact failure count, on every connector it runs. Abycolumn the model provably does not output givescolumn_not_output; acontinuityoff arole: timecolumn, orbynaming the time column, is refused. A listeddex_continuitywhose claim the declared grain orbyno longer gives is retired the same way, or keptstale,reason: continuity_changed, withkept. Each is read from the entry as the plan leaves it, so a version that overrides an inherited column retires the copy of the shared test it carried into its own entry, and the other versions keep theirs. The plan writes each kind’s generic test macro as amacro_sqldiff where the project defines none; amacro_sqlfile may hold{% test %}blocks beside its macros, as dbt reads them from macro paths. Each generated test the YAML holds once the plan lands (added,already_listed,listed_while_off) carries a per-production-runcost(#1462):estimated, with theestimatein the connector’s unit and therelationsit reads, orunknownwith areasonand never a guess.data.generated_tests.costholds the basis (prod,paradigm,unit,note,read_at, each relation’srowsandbytes) andper_run, thedex_every_runanddex_scheduledtotals apart, eachcompleteonly where every test of the cadence was priced. A relation is the model’s alias in<connector>.prod, its custom schema as dbt names it there, a view read as the tables its manifest lineage names (through); only catalog metadata is read, unasked only where reading it is free. -
A declaration also writes an observability vendor’s monitors where
monitors.vendorin.dex/config.ymlnames one (#1482; unset by default,elementarythe one vendor). A column declared with roletimebecomes thetimestamp_columnofelementary.volume_anomaliesandelementary.freshness_anomalies, model-level tests in the same YAML entry and plan as the declaration, each with no training setting of Dex’s choosing and carryingconfig.meta.dex.monitor(vendor,from: the declaration field) and thedex_monitortag. Several time columns give afreshness_anomalieson each and novolume_anomalies(ambiguous_time_column); none gives neither (no_time_column). A declaredpopulation.filtersis written as each monitor’swhere_expression(#1483):includesas<column> in (...),excludesas(<column> not in (...) or <column> is null)(no NULL arm where the column declaresnull_rule: never), joined withand, each part holding anorparenthesised, since Elementary appends it to its time-bucket filter with a bareand. Literals are typed as declared, with no cast, text escaped as thedex_population_filter_literalmacro escapes it on the connector, so a list in another type than the column’s can fail or, through an implicit conversion, change which rows are counted; the column is quoted as the adapter quotes it where it must be (quote: true, a reserved word, not a plain identifier; BigQuery and Snowflake read their own reserved words, and Snowflake’s only withquote: true). A filter that cannot be written (its column not output, a list mixing text with numbers or booleans, a Jinja delimiter, a line break, a rule with no connector) withholds the model’s monitors (filter_column_not_output,filter_unwritable), and the marker gainsfilter: population.filters. A stale monitor’s row says whatchanged(timestamp_columnorwhere_expression) and, where only thewhere_expressiondid, the current one’sreplacementstatus, so the note asks for removal only once the current one is listed. A column declared with roledimensionbecomes anelementary.dimension_anomalies(#1484), one per column withdimensions: [<column>]and the model’s one time column astimestamp_column, never one listing several, since the package groups adimensionslist by the columns’ combination: only where the exploration cache’sdistinct_countfor the model’s built relation is at most 20 (DIMENSION_MAX_DISTINCT, inclusive, written into the marker asmax_distinctand named in the decision’sdetail). Read, never measured: over the bound isdomain_too_largewith the count, no cached count isnot_profiledwith theexplore profilethat would supply one (named in a warning too), a name several cached relations match isprofile_ambiguous, and a column the cached profile flags as personal data at any confidence (afterpii_overrides) or the YAML marks ispii_flaggedat any domain, with no count reported. No time column, or several, withholds it as it withholdsvolume_anomalies. Its row addsbound,distinct_count,distinct_count_exact,profile(identifier,profiled_at) and, where the cache could not say,commandanddetail; itscolumnis the dimension column. A stale one sayschanged: dimensionswith itscausewhere the column no longer qualifies, and one whose column the cache no longer counts staysalready_listed. A hand-writtendimension_anomalieson the same one column ishand_written; one grouping by several columns is another monitor. A column declaredunit: fractionorunit: percent(#1485), and a column declared rolemeasurewith anadditivity(#1591), becomes anelementary.column_anomalieslisted under that column, with the model’s one time column astimestamp_column(none or several withhold it as they withholdvolume_anomalies) and an explicitcolumn_anomalieslist:[min, max]from the unit;[zero_count, average, sum]fromadditive,[min, max, average]fromsemi_additiveand[average]fromnon_additive, sosumis never written on a measure that does not add. A column both rows reach gets one test whose list is the union in the package’s monitor order (COLUMN_MONITOR_ORDER). Its marker carriessources(each declaration field with the monitors it gave), its row carries the same assources[]and the column ascolumn, and its decision names the column indecisionandchosen(column_name,column_anomalies), the first field asfieldand every field asfieldswhere there are several. A measure with no additivity, an additivity on a column that is not a measure, any other unit, a column not output (column_not_output), and a column flagged as personal data by the YAML, the cached profile or an unprofiled name (pii_flagged) give none. A column whose cached profile types it as non-numeric gives none either (not_numeric, #1670): the package’s numeric monitors compute no metric on it, and its row names the cached type, the profile that typed it and theexplore profilethat would refresh it (data_type,profile,command). A column the cache has not profiled is still written: its row carries theexplore profilethat would settle its type (command,detail) only where the type is unsettled, and theprofileit has (profile) where a profile exists but carries no count. A hand-writtencolumn_anomaliesunder the same column with the sametimestamp_columnishand_written, whatever its list; a Dex-written one is stale withchanged: columnand acausewhere the column no longer gives one, orchanged: column_anomalieswith the currentmonitorsand areplacementwhere the list moved. A time column whosefreshnessdeclares adeadline(HH:MM, with a required IANAtimezoneand optionaldays, #1486) gives anelementary.data_freshness_slaon the model with thattimestamp_column,sla_time,timezoneand, fromdays,day_of_weekas Elementary’s full day names; amax_lagis never read as a deadline and alone gives none. It isrelease_unsupportedbelow Elementary 0.23.1, which first ships the test, andsla_filter_quotewhere a population filter value holds a quote on BigQuery, Snowflake, Databricks or Redshift (the package repeats thewhere_expressioninside a message literal, and its re-escaping breaks the\'those connectors take); a hand-written one on the sametimestamp_columnishand_writtenwhatever deadline it states, and a Dex-written one is stale withchanged: deadlinewhere the deadline moved or was removed. On abusinessbasis column the plan writes it and warns: the test needs a value from today, which a load of the previous day’s events never holds. Nothing is written unless the package is installed (or the plan adds it) and the repository’sdbt_project.ymlenablesmodels: elementaryon the production target, read withtarget.namereplaced bydbt_prod_target: a literal, an absent setting (enabled) or a test oftarget.nameagainst literals is read, and anything else, or a per-target test with nodbt_prod_target, isunknown. Disabled or unknown, each monitor isnot_rendered(package_not_installed,production_disabled,production_unknown) and one warning says why. A hand-written monitor of the same test (and, for freshness, the sametimestamp_column) ishand_writtenand left as written, itswhere_expressionincluded; one Dex wrote that the declaration no longer gives (another time column orwhere_expression) isstaleand never removed.data.monitorsholdsvendor,package(status,release),production(status,reason,prod_target,expression),countsandmonitors[](model,test,column,arguments,field,status,reason), and is absent when the setting is unset. Each monitor Dex wrote is adata.decisionsentry read back from the YAML, withmonitorandfieldand nocolumn, so it settles no change-scope entry. Monitors are not generated tests:declarations.render_testsdoes not govern them and no per-run estimate prices them. -
The same setting writes Elementary’s PII tag (#1487). With
monitors.vendor: elementaryand the package installed (or added by the plan), every plan, with or without a declaration, tags each column a model it writes marks as PII in its YAML (any key a reader accepts, at any confidence) inconfig.meta.tags, the model inconfig.tags(both appended to tags already there), and addsdisable_samples_on_pii_tags: trueundervars:indbt_project.ymlas aproject_ymledit, so the project’s own tests keep no sample of those columns. A plan that rewrites an existing model’s SQL gets the tags but not the switch (withheld, warned): adbt_project.ymledit would stop that rewrite’s refactor comparison and downstream impact check, andtransform declareadds it in a plan of its own (fields.pii_tags.switch). The tag ispii, or the first entry of the project’spii_tags, both vars read as the project’s own tests read them: a block keyed by the root project’s name wins over the global one, and a block keyedelementaryis not read. Apii_tagswritten as one string is warned, since some releases (0.23.0 among them) match a model’s tags against its characters. Written models are those whose SQL the plan writes, those it declares and those whose YAML entry it changes;transform declareproposes a model whose only owed change is the tag (fields.pii_tags). Afalseunderpii,contains_piioris_piiwins over apii_categorybeside it, a tag in any place the package reads (tags,config.tags,meta.tags,config.meta.tags, any case) isalready_tagged, a column with a top-levelmetaand noconfig.metaisnot_written(top_level_meta), and a switch the project sets is kept as written (set_off_by_project,unread, each warned). A warning states that every test on a tagged model, the project’s own included, keeps no sample of its failing rows, and another says where the installed release reads less.data.pii_tagsholdsvendor,tag,tag_source(default,pii_tags),switch(var,status:added,already_on,set_off_by_project,unread,withheld,not_written;path),release,rule(nonebefore 0.19.2,model_tags_onlyfrom 0.19.2 to 0.19.4, which read no column’sconfig.meta.tags,model_and_column_tagsfrom 0.20.0,unknown),sampling,countsandmodels[](model,path,model_tag,columns[]withcolumn,version,status,reason), and is absent where the setting is unset, the package is not installed, or no written model has a marked column. -
transform planreports the row-population consequence of an edit to a model that already exists, underdata.row_attribution. Validation proves an edit is well formed; this is the only plan-time check that asks whether it behaves the same. In scope is everything that can change which rows enter a model:WHERE,HAVINGandQUALIFYpredicates, a join added, removed or retyped between inner and left, a swapped driving relation, andDISTINCTorGROUP BYchanges. Out of scope, and silent by construction rather than by filtering, are column expressions, aliases, casts and ordering, none of which can move a row. Each change is measured by applying it, alone, to the prior model and counting, so a delta belongs to one change rather than to the edit as a whole. That matters because a ticket routinely requires a row-population change, and a net figure cannot tell a requested change from a silent side effect. The whole-model net is reported alongside, measured on the authored model rather than summed from the parts; when the two disagree the changes interact andinteractssays so, because isolated counterfactuals do not compose. This is a warning and never a refusal, and the plan is built and stored before any of it runs, so nothing here can stop a plan from existing. Naming a change is free and opens no connection, so it always happens. Measuring one is aCOUNTaggregate over the relations the model already reads, free on DuckDB and spend elsewhere, so counting runs unasked only on DuckDB; on a billed connector it needs--attribute-rowsand then goes through the ordinary estimate and--confirm --budgethandshake, with the priced ask returned beside the stored plan so a confirmed re-run measures without re-planning.--no-attribute-rowsturns counting off anywhere. Every counting statement is oneSELECT COUNT(*)over the model, cleared by the query firewall like any agent-authored SQL, so the model’s parents must be profiled and the PII policy applies (a count projects no column, so a filter over a flagged column is still attributable and no value crosses the envelope). Nothing is materialized and no relation is created. Static{{ var() }}calls with a scalar value indbt_project.yml(or a scalar default argument) are resolved in place; a change dex cannot isolate or measure reportsattributed: falseand names why: macro-generated SQL, a jinja statement block, an unresolved or non-scalarvar(), a renamed or added CTE that cannot be paired with a prior scope, a changed set operation (aUNION,INTERSECTorEXCEPT, or a scope that becomes or stops being one), whose branches are not compared, a relation absent from the cache, or a counterfactual that is not valid on its own because it depends on something else in the same edit. Authoring a model that does not exist yet produces no findings and opens nothing. -
transform planraises two advisory warnings about the shape of what was authored, both free, both static, and neither able to refuse a plan. The first compares the authored SELECT list against the columns the model’sschema.ymldeclares, in both directions: a declared column the SELECT does not produce, and a produced column the declaration does not name. A model with no declared columns has no contract and produces nothing. A*ort.*is followed through the statement’s CTEs, subqueries and joins (a semi or anti join adds nothing,EXCLUDE/EXCEPTremoves its columns), then to aref()’d model’s own SQL as the plan leaves it, then to the cache’s profile, which any divergence warning resting on it names, since a profile can be stale. A model the plan changes is never read from the cache. A SELECT list that still cannot be resolved says which case it was (a*over a relation with no single profile, a macro standing in for a column, an unaliased expression, a set operation, aRENAME, a table function, SQL that did not parse) rather than guessing, and an aliased macro call is resolved by its alias. The same read, with no cache, checks a declaration’s columns against the model, so a declaration naming a column absent fromfinalis refused as it is for a direct SELECT list. The declaration is read with this same plan’s ownschema.ymledits overlaid, so a model and its documentation edited together are compared against each other rather than against a stale file. The second reads a house convention out of the project’s own models: an authored model exposing a raw foreign key where its siblings all resolve the equivalent key to a descriptive attribute. Siblings are the models sharing the authored one’s folder and its layer prefix, widening to that prefix project-wide when the folder is too small to hold a precedent. At least three of them must resolve a key of the same id-suffix shape and none may pass one through, since one counter-example is enough to say the house has not settled the question (a fact table beside the dimensions is that counter-example, and a*_keyconvention says nothing about a*_id). A key naming the model’s own entity is its identity, not a foreign key. And the project must hold a parent to resolve against, because the fix is aref(). The warning names the siblings and the parent so the inference can be argued with. Both read the project as this plan will leave it, so models authored together inform each other, and both judge only what the plan authors: an existing violation elsewhere in the project is not this plan’s warning. The convention check is the only one dex raises on a style judgment rather than on a fact, which is why it is the only one a project can decline:conventions.resolved_keys: falsein.dex/config.yml, named in the warning itself. -
transform apply [plan-id]re-hashes every file first. A file edited by a human after the plan was made is a conflict: nothing is written, the divergence is returned as diffs withneeds_confirmation, and only an explicit--confirmoverrides it. A stored plan whose change scope records an undeclared population change is refused before anything is hashed (#1230), naming each change underdata.undeclared_population_changes; an assumption naming its column, or--accept-population-change "<reason>"recorded on the plan, settles it. An apply is all-or-nothing across the whole plan: one conflict refuses the set, so the clean edits beside it do not land either. The stored paths are re-checked against the project format’s editing surface at the same time, and a path outside it is refused outright rather than surfaced for confirmation, since nobody can accept a write into a region the format says it does not own. With no plan id it applies the latest unapplied plan of any kind (semantic plans included;emit dbtremains the semantic-scoped spelling).transform planslists what is stored, pending and applied. -
No plan id names the plan; an empty one is refused.
transform apply,export,ground,classifyandcompareall read a missing id as the latest unapplied plan, and each says which one it picked:data.resolved_planis{plan_id, intent, created_at, resolved_from: "latest_unapplied"}, besidedata.plan_id, and onewarningsline names the same plan, on a refusal raised after the pick too (a containment refusal on apply, a plan with no baseline on compare), where a host calling the engine in process finds it as the exception’sresolved_plan. An explicit id carries neither. An id given but empty or blank (apply "", which is whatapply "$(dex transform plan ...)"passes when the plan failed) is refused withreason: requestbefore the store is read, and so are an empty--plan-file,--for-planand--for-plan-file, because reading any of them as absent does something the caller did not ask for (#1103). An unquoted empty substitution leaves no argument at all and cannot be told from an omitted one, which is why the resolution is always named. -
A commit of what dex wrote credits Dex. dex never commits, so an apply
that wrote at least one file, from the store or from
--plan-file, hands the credit to whoever does:data.commit_trailerisCo-authored-by: Dex <dex@exmergo.com>, the last paragraph of that commit’s message. The forge credits the account with that email verified. An apply that wrote nothing, or stopped atneeds_confirmation, carries no trailer. -
A plan can leave the process that made it.
transform exportreturns the stored plan as a document, andtransform apply --plan-fileapplies one in a checkout whose plan store has never seen it. That path needs a repo root and nothing else: no store, no connector, no cache, no dbt, no jinja, no SQL parser, no network. The only repository-controlled content it reads isdbt_project.yml, parsed with YAML’s non-constructing loader, so it can learn where files may live. The document carries a digest, and what that digest is worth is stated rather than implied. It proves the document is internally consistent: recompute every content hash from the content carried, recompute the digest from those, and a byte changed anywhere fails. It is not a signature and cannot be, because anything that can rewrite the content can rewrite the digest beside it. The caller closes that gap by carrying the digest across the boundary by a route it trusts and passing it as--expect-digest, which is the one check that catches a document re-signed after the fact. A digest presented as tamper-proof is worse than no digest, since it invites skipping the pinning that does the work. Containment and kind placement are re-checked against the applying checkout’s own declared surface rather than trusted from the document, for the same reason the preimage hashes are re-checked: the document is an artifact that crossed a boundary, and what it was validated against is not what it is being written into. Both are hard refusals, and--confirmdoes not reach them; confirmation is the handshake for a human edit somebody can look at and accept.transform groundandtransform classifyare the other two halves a caller needs before it decides: what the plan depends on and how complete that answer is, and what its edits actually contain. Both are repo-only and free. Seereferences/host-integration.mdfor the whole seam, including the conformance vectors shipped for a consumer to assert its own reader against. -
transform buildaccepts--target,--select(one or more selector expressions or space-separated model names, matching dbt’s syntax),--full-refreshand--verify. The target must bedev(or thedbt_targetnamed in.dex/config.yml); production-looking targets are refused outright, before the cost gate, and--confirmcannot override the refusal. On a billed connector the cost gate is priced upfront: dex runs a freedbt compileand dry-runs each compiled node through the connector’s own estimator (the same oneexploreuses), summing the result into theneeds_confirmationestimate. It is a partial floor when a cold dev target has not built a node’s inputs yet, and degrades to no estimate (with a note) when dex cannot open its own connection; the ceiling and the server-side per-statement cap bind regardless. On BigQuery, an incremental node whose batch filter is bounded by a subquery (the usual watermark over{{ this }}) is an upper bound rather than a measurement: a dry run prunes partitions only on a constant bound, and the job prunes on the subquery’s result when it runs. Itsper_table_bytesline is kept, since it is still what the job can bill at most, anddata.upper_boundsmaps each such line to the column it bounds; a note, and the over-ceiling refusal, say how much of the estimate those lines are. Where the Elementary package runs work no compiled node shows (#1309), the estimate is a floor and says so, keyed off what the package does for the target and never off whether it is installed:cost.unpricednames the kinds by code on the ask, the over-ceiling refusal and the finished build (elementary_hookswhere itson-run-startandon-run-endhooks run;elementary_monitoring_testswhere the package is enabled and the build selects its anomaly,schema_changesand other tests that check it, each with thedays_backwindow it reads; andelementary_test_extraswhere dbt picks Elementary’s test materialization, which can count each selected test’s failed rows and query a sample of them),data.unpricedholds the record (work,hooks,monitoring_testswithdays_backanddays_back_source,monitoring_test_count,materialized_test_count,release,release_reason_code), and one warning per kind says what was left out. On an Elementary release outside the range from the oldest release the fixture runs to the newest, or one that cannot be read (#1445),release_reason_codeiselementary_release_untestedorelementary_release_unknown, each kind is counted wherever it may run (hooks that would return early, the monitoring tests and the materialization’s extras of a disabled package, and the package’s own tests among the extras), a defaultdays_backisunknown, and one more warning names the release and the newest tested. The build’s own pricing names its gaps in the same list (#1099):build_nodeswhere a compiled node’s dry run failed (the warning naming the nodes and calling the total a partial floor stays), andverificationwhere a--verifyphase could not be priced upfront.cost.estimate_qualityfollows the list:exactbecomesapproximate(anunknownstaysunknown), a total of zero becomesunknown, and neither is everexact.data.unpricedstays the Elementary record and is absent without the package. A project without the package gets no Elementary code, so a build that also priced every node and phase reportscost.unpriced: null. One that disables the package for the target gets no monitoring test or test extra, and its hooks are named only where they still run: dbt disables them with the package’s models, and a release before 0.20.0 whose hooks stay declared runs them without checking. A free connector prices nothing and claims nothing. dbt runs with cwd pinned to the project dir (relativeprofiles.ymlpaths resolve there, never against the caller’s shell). Whenpackages.yml(or adependencies.ymlwith packages) is declared anddbt_packages/is missing,dbt depsruns automatically first;transform depsis the explicit install/refresh.--cold-depsis the explicit proof that a repair survives a reinstall: packages install into an isolated copy, the build runs from it, anddata.cold_verificationlists what the installed tree held that the reinstall did not reproduce.data.prerequisitesnames each failed node’s owner, plan relation, previous-run context and supported repairs. A missing dev DuckDB database is an actionable refusal when the project reads from sources (seed it first), and a warning otherwise. On failure the envelope’serrors[0]carries the first real dbt message; the rest land inwarnings, per-entry capped, deduplicated, with a pointer to the full log when anything was trimmed. Each node indata.nodescarries dbt’sunique_idalongside a readablename. The two are distinct because a generic test’s id ends in a content hash, so a name taken from the last segment reads as3249b83c15; a green build reporting seventeen warning tests has to be able to say which seventeen. -
transform build’ssuccessis dbt’s exit code, anddata.outcomeis what the run established. The two are not the same question and the gap between them is not small: a build whose--selectmatched no nodes at all exits zero, and so does a build of a model the change never touched.successkeeps meaning exactly what it meant, because that is the right meaning for a command line and because consumers read it.outcomeisvalidatedonly when every node the change required ran and passed against artifacts that still describe the tree; otherwise it isempty_selection,unrelated,partial,skipped,indeterminate,stale,failed, ornot_run, each of which a caller acts on differently.indeterminateis a run where nothing failed and a node reported a status dex does not recognize (partial success,no-op): such a node is never counted as built and never read as a pass, and a required one is listed underdata.completion.deliverables.unrecognized.built_unverified(#1230) isvalidatedwith part of a named change still open, each reason underdata.completion.unverified: a rewrite applied uncompared while its baseline was ready, an undeclared population change apply did not accept, or a high-severity finding the plan introduced (or, with no baseline, one on a model it edited), or an unedited model below the plan’s edits whose rows or keys moved with nothing recording that population (#1231). It is set ondata.outcomeanddata.completion.outcome;data.evidence.outcomekeepsvalidated, since a host recomputes that one from the evidence alone.data.evidenceis where the reasoning lives: the dbt invocation, per-node status and materialization and relation, what the selection asked for against what it matched, the manifest and run-results digests, the relations the run’s successful nodes generated (a skipped node’s surviving relation is not one), and the principal errors.data.completionleads the payload with the bounded summary of all of it, becausedata.nodesgrows with the project and a reader whose harness cuts the output after a few kilobytes otherwise sees successful staging models and nothing about the deliverable that was skipped.coverageneeds to be told which change the build is for, through--for-plan(a stored plan id) or--for-plan-file(an exported plan document, which is what a build sandbox holds instead of a store). It reports the nodes the change required, which of them ran, and how each requirement was derived: a model edit requires its own node, aschema.ymlthe nodes it documents, and a semantic YAML the dbt model its semantic model sits on. An empty--for-planor--for-plan-fileis refused rather than read as absent. Without either flag there is no coverage and the key is absent rather than empty, because an empty coverage block reads as “nothing required was built”, which is the opposite of “nobody asked what was required”.coverage.coveredmeans a requirement matched a node in run results, including failed and skipped nodes;missingmeans it matched none.builtlists the requirements whose matched nodes all succeeded, andnot_builtlists the rest (including missing requirements). These two lists partitionrequired. Older evidence documents without these fields still validate and expose them asnull(unavailable), not as a measured empty list. Outcome precedence and artifact digests retain their existing meanings. Each prerequisite’sprevious_runreports its status in the last available build artifact from the same target and dbt runtime. Available evidence carriesstatus,invocation_id,generated_at,selection,target,runtimeandrun_results_sha256. Unavailable evidence hasavailable: falseand areason_code:no_previous_build,unreadable_previous_build,incompatible_target,incompatible_runtime, ornode_not_observed(which retains the run context). Completion blockers carryprevious_statustoo. This context never changesplan_relation: a different selection or source tree may have produced it, and an earlier failure is not proof of causality. Dex saves only statuses and run metadata index_previous_build.jsonbeside the resolved artifacts before pricing clears run results. Confirmation retries reuse it; compile, seed, test and run results never replace it. Ordinary and cold builds keep separate histories. No extra baseline build or scan runs.selection.completeisnullfor any selector using dbt’s graph operators or method selectors. dex does not evaluate dbt’s selector language, and a second implementation of it would disagree with dbt’s own.staleis worth reading twice.stale_artifactsis the obvious version, a manifest older than the model sources, and it is close to unreachable from a build that just ran, because a successful dbt build rewrites its own manifest.plan_driftis the reachable one: a file the plan wrote no longer holds what the plan wrote, so the run validated a tree the plan does not describe. It fires on builds that otherwise look perfect. -
transform build --no-install-depsrefuses a missing package instead of installing it. The default is unchanged and still runsdbt depspost-gate, which is what an interactive user wants and what keeps a first build from failing on a step the agent has no verb for. In a sandbox with no network and a pinned dependency set the correct outcome is the opposite, and a dbt failure to reach a registry names nothing useful. The refusal (reason: prerequisite) names each declared-but-uninstalled package and its version, and it fires immediately after the dev-target check, before any subprocess and before the freedbt compilethat prices the run, on the same argument the dev-target check already makes: work that cannot succeed should not be priced first. A declaration dex cannot check by name (a git URL names a repository, and dbt installs under the package’s own name) is reported separately rather than named on a guess. -
transform buildrebuilds a seed whose CSV header or declared column types changed. dbt loads a seed into the table it already built, so a header that gained or lost a column fails to load and every model reading the seed is skipped behind it, and one that reordered its columns loads each value under the wrong name (dbt-duckdb loads by position). On DuckDB, before the build, dex asksdbt lswhich seeds the build selects (dex does not evaluate the selector, and a default selector inselectors.ymlcounts), compares each one’s header with the columns of its table in the DuckDB file the dev target writes, and runsdbt seed --full-refreshfor each seed that differs. The same holds for a seed whose declared+column_typesno longer match the column types of its table (#1083): a reload keeps the types the table was first built with, so a type repair to the project’s own input data would otherwise do nothing. Types compare through the connector’s aliases, so an equivalent spelling (intforINTEGER) is not a change. Removing a previously applied type declaration also rebuilds the selected seed, restoring CSV inference. Dex remembers successful seed loads index_seed_column_types.jsonbeside the runtime’s artifacts before pricing ordbt lscan replace the manifest. Failed and unselected seeds do not update their entries; timestamps prevent an older artifact from replacing a newer load. Ordinary and cold builds share this record for their common dev seeds, independently of prerequisite history. It adds no scan. Without an available applied contract, use--full-refreshexplicitly when removing a type declaration.dbt lsparses afresh for the target, so neither a cleaned target directory nor a manifest left by another target decides which table a seed loads into; it adds one dbt invocation to every DuckDB build whose dev database file already exists (a file that does not exist yet holds no seed table to compare).data.full_refreshnames the rebuilt seeds (seeds,success) and a line inwarningssays why; a refresh that fails stops the build, withdbt seed --full-refresh failed: ...aserrors[0]. A dev target dex cannot read is named inwarningsand the build runs as it did before the check existed. Billed connectors do not run the check: the refresh would spend warehouse time outside the spend the build settles. -
transform build --full-refreshrebuilds an incremental model from scratch (#1015). An incremental run only adds or merges rows, so once an incremental model’s logic changes, the rows the old logic wrote stay in the dev relation until it is rebuilt. The flag passes dbt’s own--full-refreshtodbt build, on the dev target only. It is for that case, not a routine build, since a full rebuild scans the model’s whole history. The pricing compile runs with--full-refreshtoo, sois_incremental()renders false and each rebuilt incremental model is priced as the fullSELECTthat runs rather than as its batch. On BigQuery its line then has no watermark filter and is not an upper bound. A model whose ownfull_refresh: falsemakes dbt ignore the flag keeps its incremental branch and its watermark filter, so its line is still named underdata.upper_bounds. A note in the estimate counts the incremental models and seeds priced as a full rebuild.data.full_refreshis{requested: true, models, seeds, not_refreshed, success}, read from the build’s own artifacts.modelsare the selected incremental models andseedsthe selected seeds.not_refreshednames any whose ownfull_refresh: falseconfig makes dbt ignore the flag, so their rows are not read as rebuilt. Tables and views are rebuilt by every build and are not listed. Snapshots ignore the flag.data.evidence.invocation.full_refreshistrue, andfalseon every other build. With no--select, awarningsline counts the incremental models and seeds the build selected, which is the whole project unless a default selector inselectors.ymlnarrows it. The DuckDB stale-seed refresh above does not run, since the build already rebuilds every seed it selects. A failed build keepsdbt build failedas itserrors[0]prefix.--verifycompares the rows of each model indata.full_refresh.modelswith its driving parent (#1020), and prices that parent’s count in the same estimate. An incremental model this build did not rebuild, one innot_refreshedand a microbatch model, which rebuilds only from itsbegin, keep the row-population skip, named inwarnings. -
Every dbt invocation Dex runs on the project writes one artifact directory
(#862, #1014). Dex’s pinned dbt and a project’s own runtime (a CI image, a
teammate’s install, a benchmark grader) used to share
target/. When their versions differ, the second can fail before it evaluates anything. One observed case: dbt 1.12 leavestarget/run/<project>/snapshots/<name>.sqlas a directory, and dbt 1.10 raisesIsADirectoryErroropening it as a file. The directory is resolved once per command, before any gate, fromtransform.artifactsin.dex/config.yml(orartifacts=onDexEngine.build). Every invocation receives it as--target-path: the build, the compile that prices it, the seeddbt ls, and the settlement read after a failed run.isolated, the default, is<target-path>/dex/<dbt-version>/. The runtime key is the dbt-core version, so two Dex runs share partial-parse state while another runtime never sees it. Where the version cannot be read (the build falls back to adbtonPATH), the key isdbt-unknown, which still isolates. The directory sits inside the project’s target path, so git and Dex’s own shadow copies ignore it as they ignoretarget/.dbt cleandeletes it with the rest of the target path whenclean-targetslists that path, as it does by default; the next build writes it afresh. The project’s owntarget/is never written.sharedis the project’s own target path, for tooling that must find the artifacts there. Before anything runs, Dex refuses (reason: guard) a directory that holds a snapshot path another runtime left as a directory, or amanifest.jsonwritten by a different dbt minor version. The refusal names both ways out:dbt cleanwith the runtime that wrote it, or unset the setting. Nothing is deleted.
DBT_ENGINE_TARGET_PATH(dbt 1.12’s spelling, read first), thenDBT_TARGET_PATH, thentarget-pathindbt_project.yml, thentarget. A templatedtarget-pathcannot be rendered here and falls back totarget; settingDBT_TARGET_PATHto the rendered path points readers and thesharedpolicy at the directory dbt uses.data.artifact_directoryis the project-relative label of the directory written. Readers do not know which tool wrote last. Every manifest, semantic-manifest and run-results reader (maintain verify,--use-project, localexplore semantic,transform ground, the dev-target preflight) reads the newer of Dex’s directory and the project’s own. That is a Dex build right after it, and the user’s owndbt parseafter that. A build’s own reads (its pricing pass, its--verifysweep) are the exception: they read the directory the build wrote, and only that invocation’s run results, so a dbt process writing elsewhere meanwhile cannot hand the sweep another run’s manifest or another run’s passing tests. dbt’s JSON log names the invocation on every line. Arun_results.jsonthat names a different invocation (an earlier run, another tool) has its nodes dropped, the build is reported as a failure that says so, and no evidence is built from it. A missingrun_results.jsonisnot_runin the evidence, and one that lists no nodes isempty_selection.successstays dbt’s exit code, so it can betruefor either of those: readdata.outcome, neversuccessalone, to learn whether the build established anything. -
transform build --verifyalso compares each built model’s columns with itsschema.yml, with the detector and the finding codes ofmaintain verify(column_missing,column_undeclared,column_type_mismatch), scoped by unique id so one version of a model does not answer for another. It reads metadata through the adapter the build holds: no statement, no estimate line, no second handshake.data.verification.column_contractholdschecked,no_declared_columnsandunchecked(model,reason_code:not_built,no_relation,relation_not_found,metadata_unreadable), andsuppressed.column_contractgives the reason when nothing was compared. A metadata failure explains the gap and keeps the build’s result; a cost refusal is raised as usual. -
transform build --verifyruns themaintain verifysweep over the nodes this build touched and reports it underdata.verification, in one envelope with the build result. Opt-in on every connector, free ones included.data.verification.ranis always present: a build that did not verify and a build that verified and found nothing are different answers, and only the second means the models are clean. When it ran, the payload addsscope(only models with statussuccessin this invocation),scope_not_built(the other reported models),findingsandfinding_countin the shapemaintain verifyreturns them, andsuppressed, naming every finding class that did not run and why. Model names. A model is named the way dbt selects it, here and inmaintain verify, in the build’snodes, and in the per-node estimate. A versioned model carries its version,dim_customers.v2, the latest one included, because two versions are two relations that share onenameand either can fail, lose rows, or go missing on its own. The sweep’s scope names the successful models from the exact nodes the build ran, so a build ofdim_customers.v2never judgesdim_customers.v1. As in dbt’s--select,maintain verify dim_customersselects every version andmaintain verify dim_customers.v2selects one; the file stem that builds a version (dim_customers_v2) selects that version too. A plan’s deliverables name a version by its label, so a--for-planbuild ofdim_customers.v2never answers fordim_customers.v1, and with--verifythe build holds the plan’s versioned models to its own manifest underdata.verification.model_versions(a record per version, default and consumer, each reachingdata.completion.obligations; #859). Findings never fail the build. A build dbt completed is a build that completed; whether arow_lossshould gate a pipeline is a caller’s policy, so findings stay out oferrorsand never change the status. A pointer line inwarningsnames the count so a caller reading warnings alone still learns they are there. A build that failed partway still reports the build-status half, which is when “which node failed, and what did it take down with it” is worth most; row population and the declared facts are suppressed there, because a half-built dev target is a mix of this run’s output and the last one’s. An intended expansion ranks low. Arow_fanouton a model whose grain this build proved, by its own passinguniqueorunique_combination_of_columnstest or by the declared-fact count, is capped atlow, withdata.grain_provenanddata.severity_cap_applied: grain_proven(#841). The finding stays listed, so a gate onhighneeds no allowlist for a model that fans out by design, and a later fan-out on a wrong key elsewhere still ranks on its counts. Declared facts. The sweep checks what each built model’s declaration says (#496):unit_out_of_range,additivity_contradictedandpopulation_contradicted, exactly asmaintain verifyreports them, plus a declared grain nouniquetest in the build already checks (a composite grain always), reported asgrain_brokenwithsource: declaration. A single-column declared grain renders as auniquetest, which the build itself runs, andnull_rule: neverrenders asnot_null, so neither is checked twice. A declaredpopulation.parentis held to the parent’s keys (parent_population_missing,parent_population_unexpected, #857), and a declaredhistoryto the snapshot’s versions (temporal_*, #1027, one record per contract underdata.verification.temporal_contracts), and a time column’s declaredfreshnessto the warehouse’s clock (freshness_exceeded, #1460, and a declared dailydeadline,deadline_missed, #1486, one record per declared check underdata.verification.freshness). A built model that declares no parent is measured against the parent dex drafts for it (#1228): orphan keys, missing parents and rows whose child columns are all NULL or zero (a sign of no child, not proof), one record per drafted model underdata.verification.population_delta, apopulation_deltafinding andcompletion.obligations.needs_decisionwhere the counts ask which rows belong. Only the plan’s models with--for-plan, at most 25 without. Every class that did not run is named insuppressed(grain,unit,additivity,population,parent_population,temporal,freshness);population_deltanever is, since each model it considered has its own record. Join coverage. Every equality join the built models write is measured asmaintain verifymeasures it (#857), with one record per join underdata.verification.join_coverageand per declared parent underdata.verification.parent_population, andjoin_contractsuppressed with its reason when it could not run (a failed build, no joins, no connection).no_relationis never reported from a build: dbt’s run results are authoritative for the nodes it just ran, and a node it reports assuccesshas a relation whether or not dex’s source scope covers it. Cost. The row counts a verdict needs are priced during the build’s own pricing pass, off the manifest the freedbt compilewrote, and folded into the same estimate under a(row counts)entry in the per-table breakdown, so one--budgetcovers both phases. The declared-fact statements are priced the same way under(declared facts), and the join coverage statements under(join overlap probes), each gated after the build as their own phase of the same reservation, never as a second budget. Only relations the warehouse keeps no row count for cost anything, which is any view, and a view is dbt’s default materialization; a table’s count is free metadata. On a connector with no cost gate every count is made exact instead, because doing so bills nothing. Where the counts cannot be priced upfront (a cold dev target has nothing to dry-run against yet) a note says so, and they are priced again after the build as a phase of it, drawn against the reservation the build is already holding rather than as a second command. A phase that does not fit returnsokwith the counts priced indata.offer, neverneeds_confirmation: the build is finished and billed, and reporting otherwise would invite a caller to pay for it twice. Read scope. Every other command refuses the namespace dbt writes to as a source, so exploration can never mistake a built model for a source table.--verifyalso reads that namespace for the length of the command, because the relations dbt just wrote are its subject. It is held apart from the committed allowlist and bounded by its own rules:- It need not exist. dbt creates it on a first build, so before that build it reads as empty, and the build is priced on its sources as usual. A committed allowlist entry that names nothing is still refused.
- It is listed after dbt has run, so a first build sees the relations it created, and a rebuild is judged on the row counts dbt just wrote rather than on the ones listed while pricing.
--scopenarrows the sources and nothing else: it can neither name the dev namespace nor drop it from the build that is judging it.- An allowlist that already covers it (the whole dev database, or an empty allowlist) reads it once.
connection.targetwhile it is read, and nothing is written back to.dex/config.yml. A model or package that sets+schemabuilds into<dev schema>_<name>under dbt’s default schema naming; the manifest’s relations in such a namespace, in the dev namespace’s own container, are this target’s output, so--verify(andmaintain verify --target dev) reads those namespaces too and says so innotes(#1155). Where the built relations still cannot be seen (a customgenerate_schema_namethat lands outside the dev namespace’s naming), row population is suppressed with a reason that names the gap rather than comparing nothing and reporting clean. -
semantic definerefuses names that already exist in the project (useupdate);updaterefuses names that do not (usedefine);semantic planaccepts a mix and classifies per name, reportingdefined,updated,unchanged, andremovedin the envelope.updatedmeans the definition’s parsed content actually differs from the project’s; a definition re-stated identically in the file that already holds it isunchanged. The distinction matters because a whole-file payload restates every definition in the file, so without it a two-metric change reports thirty objects as updated and the real blast radius is invisible in the one place a reviewer checks it. Key order and formatting are not changes; list order is, and identical content written to a different file is a move, so both read asupdated. -
Two payload units.
--edits-filecarries whole files.--definitions-filecarries individual definitions:{"definitions": [{"kind", "path", "content"}, ...]},kindbeingsemantic_modelormetric,contentthat definition’s YAML body (a mapping, written without the leading-). The name is read from the content, so the two cannot disagree.pathis optional for a name the project has, defaulting to the file that declares it. For a new name it defaults to the one file that declares every existing definition of that kind or, when none of that kind exists yet, the project’s only semantic file, with a warning naming the file, and is required when there is no such file or more than one. An explicit path that would relocate an existing definition is refused, because writing it to a second file duplicates the name. The engine writes each definition in place and preserves every other byte, comments included, then re-parses the result and compares it against what was sent. A file whose layout it cannot span safely (a flow-style sequence, anchors or aliases, multiple documents, tab indentation) is refused with--edits-filenamed as the way to edit it. Anchors and aliases are read from the YAML parse, so*emphasis*in a comment or a description does not count as one, and a file that does not parse is refused saying so. A project file that does not parse hides the definitions it declares, so a refusal that would call a name absent names each file that could not be read and why instead of reporting it “not in the project”. Classification is scoped to the definitions named, so a spliced file’s other definitions are reported in no class at all. Names implicitly created bycreate_metric: truemeasures count as existing metrics everywhere. Beyond MetricFlow’s schemas, the engine resolves every metric input (ratio and derived inputs must reference metrics, not measures) and then runs the emitted YAML through dbt’s own parser against a throwaway copy of the project; a plan that fails parse is never stored. When dbt is unavailable (or the project has no time spine yet) the parse degrades to a warning;--no-parseskips it. A stored semantic plan is applied withtransform applylike any other plan (no id applies the latest unapplied one). -
Removing a definition is an entry with
"op": "delete", which carries thename(there is no body to read one from) and nocontent. It is always declared: a definitions payload never removes a definition for having gone unmentioned, because an unmentioned definition is what the unit promises to leave alone.semantic definerefuses a removal;updateandplanaccept one, and it is reported as a fourth class,removed. One payload names each definition once, so what it asks for cannot depend on the order it is read in. A removal the surviving project still reads is refused, naming the reader and its file: a metric whose input is a removed metric, or a measure of a removed semantic model (create_metricnames included). The check is over the state the payload leaves behind, so adding those readers’ own removals or updates to the same payload satisfies it, in any order; what a reference index cannot resolve statically (aMetric()call inside a filter string) is left to dbt’s parser. A removal that would leave a file declaring no semantic model or metric is refused as well, pointing attransform plan --edits-file: emptying or deleting a file is a file-level act, and the semantic verbs delete no files. The file comes back without that one definition, as an ordinary content edit, so the plan store, the diffs, andtransform applysee the unit they always have. -
semantic ossie define|update|planis the corresponding native-file route. Its namespace guard is the semantic-model namespace across every configured document:definerejects existing names,updaterejects missing names, andplanreports a mixed change underdefinedandupdated. Each edit is a complete configured.ossie.yaml,.ossie.yml, or.ossie.jsondocument, one semantic model flat at its root (the earlier wrappedsemantic_modellist is refused with the migration named); Dex overlays all edits in memory and validates the prospective configured set before storing anything. It writes the accepted content byte-for-byte, with no YAML/JSON reformatting, and never changes a configured document absent from the payload. File removal is not part of this command. -
semantic slayer define|update|planis the same route for SLayer model files. Each edit is one whole model file keyed assemantic.slayer.modelsnames it, relative tosemantic.slayer.base_dir, and nothing else under the storage root is writable. The prospective set is validated with the pinned release’s ownSlayerModel(current formatversion, unique names, path agreeing with name and data source, joins resolving within the set onto columns both sides have) and, for an edited model, adefault_time_dimensionthat names a column, no key the pinned release does not declare at its level (SLayer ignores one, so it would be written and do nothing), and saved-measure formulas that parse. Every refusal names the file, the element, and for an unknown key the pinned release. Apply writes the authored bytes, all files or none, and a file SLayer’s own storage rewrote after planning is a conflict that says so. -
semantic cube define|update|planis the same route for Cube model files. Each edit is one whole plain-YAML file keyed assemantic.cube.filesnames it, relative to the repository root. A path off that list, a JavaScript model,globals.py,cube.py/cube.js, a configured file that is compiled-only on disk, and authored content that is compiled-only (Jinja, orextends) are refused by name, a compiled-only one with the reason the catalog’scompiled_onlygives. The prospective set is validated with the reader’s own port of Cube’s model rules (structure, unique names across cubes and views, join targets and{member}references resolving, viewjoin_paths following declared joins, one join between a pair of cubes), and a key Cube does not declare is refused in a file the plan writes rather than warned about. A summing or counting cube on the one side of a join with noprimary_keyis afan_outwarning. Each cube and view an edited file carries is reporteddefined,updatedorunchanged. Apply writes the authored bytes, all files or none, and a file changed after planning is a conflict. -
semantic databricks define|update|planis the same route for Databricks Metric View YAML files (#1258). Each edit is one whole view body keyed assemantic.databricks.filesnames it; a path off that list, a.sqlfile, another suffix and a stem another file names are refused by name, and a delete is refused. The prospective set is validated by dex’s port of the Metric View YAML 1.1 rules, every error refusing it, and in a file the plan writes an unknown key (at any level,relyincluded) andfieldsbesidedimensionsrefuse it too. Each view is reporteddefined,updatedorunchanged, compared as YAML 1.2. Apply writes the authored bytes, all files or none, a file changed after planning is a conflict, and nothing is deployed. -
semantic snowflake define|update|planis the same route for Snowflake Semantic View YAML files (#1292). Each edit is one whole file keyed assemantic.snowflake.filesnames it, its view named by its ownname; a path off that list, a.sqlfile and another suffix are refused by name, and a delete is refused. The prospective set is validated by dex’s port of Snowflake’s specification and validation rules, every error refusing it, and in a file the plan writes an unknown key,access_modifieron a dimension andunresolved_member(a read qualified with its own table naming no member) refuse it too. Each logical table (view.table) and derived metric (view.metric) is reporteddefined,updatedorunchanged, compared as YAML 1.2, and a change to a view’s other parts only reports the view. Apply writes the authored bytes, all files or none, keeping each file’s mode, a file changed after planning is a conflict, and nothing is deployed.
explore fronts connect/explore; transform
fronts transform and semantic; maintain fronts the whole
maintain group. Within maintain, snapshot manages the baseline, check
plus schema/volume/grain/semantic detect drift (read-only), and
reconcile is the only verb that emits diffs (applied through transform apply). Detection is read-only on every connector, but read-only is not free:
schema, volume, and the reference half of semantic read metadata and run
immediately, while grain and the dimension-cardinality half of semantic scan
the warehouse and take the --confirm --budget handshake on billed connectors;
check runs the free axes first and returns one combined estimate for the
scanning axes.
That estimate arrives as an offer on a complete answer
(cost-controls.md), not as a pending charge. check and
semantic finish their free axes on every call and return ok, with the price
of the scanning axes under data.offer, which carries axes naming what the
estimate would add. data.axes_run names what completed, and reading both is
how a caller tells “grain found nothing” from “grain did not run”, which the
status used to imply.
The Elementary package’s relations are not the project’s drift. On a project
that runs the Elementary dbt package, every run appends to the package’s history
tables, leaves some of them empty and some columns NULL, and an upgrade adds a
column, so against a baseline that pinned them maintain check used to report
row_count_changed, no_rows, fully_null_column, key_lost_uniqueness and
column_added on them beside the project’s own findings (#1590). The schema,
volume and grain axes now leave them out (#1613), on check and on the focused
schema, volume and grain. They are recognised by the one shared recogniser
(package_relations in explore/elementary.py): the namespace signature
explore map uses (#1311), read over the warehouse’s identifiers and the
baseline’s, so a __tmp_ table the package dropped since the snapshot is not
reported dropped. Where the newest manifest on disk is readable it can only
narrow that reading: a recognised relation the manifest says another package
(the project) builds, in a namespace it names, is the project’s, and a relation
it does not name keeps the signature’s reading, since the manifest is parsed for
dev and the baseline may be production’s. They are taken out of both sides
before any axis plans, so nothing is described, scanned or priced on them, and
any finding still naming one is dropped, from the envelope and from the drift
report reconcile reads. data.excluded is the block explore map returns,
always present on these four commands (count: 0 and reason: null when
nothing was left out), and a note names the namespaces and the way back. A
project relation in the package’s schema that is named like none of its models
is still checked; a relation named in <objects> is checked whatever it is,
and a scoped call leaves nothing out; --include-elementary checks them with
the rest, so an upgrade’s schema change stays reachable. The semantic axis
reads the project’s definitions against the full warehouse, unchanged, and
maintain semantic carries no excluded. Whether the package is running is
maintain incidents’s to read: its sources entry, and the coverage timeline,
which shows a run with the hooks off as an unobserved interval.
A baseline reports its own coverage, and the axes only compare what it
covers. maintain snapshot pins the exploration cache, and a cache is thin
whenever explore map stopped at its rank cutoff: past 50 objects it profiles
the top 25 and enters the rest as metadata alone. An object the baseline holds no
columns for has an unknown column set, not an empty one, so the schema axis
compares no columns for it rather than reporting every live column as added, and
the grain axis has no keys to probe. Both snapshot and the detectors warn and
name the objects, and snapshot reports column_detail_count beside
dataset_count, so partial coverage is never mistaken for a clean bill. Run
explore map --full before snapshotting to cover everything. The detectors also
warn when the baseline was pinned from a cache older than
profile_freshness_hours, judged on the capture time recorded in the baseline
rather than on which file was written last, so re-pinning cannot silence it.
A baseline does not pin a profile its relation has moved past, where it can tell. The cache keeps
a profile until something profiles that relation again, and a transform build
that adds a column to a model does not, so pinning the cache as it was made the
next maintain check report the columns the plan shipped as column_added
(#1518). Before pinning,
maintain snapshot compares each cached profile’s columns (names, types,
nullability) with the relation’s table metadata, the free read the schema axis
makes, and reads the dbt runs on disk and Dex’s node record, each build counted against the
relation each run recorded (the manifest’s only for the invocation that wrote
it; any other build is left out and counted under builds.unattributed). A
profile whose columns moved is schema_changed: it is
pinned from the metadata, which is what the schema and volume axes compare
against, without the keys and distinct counts that described the relation
before, so the grain and cardinality axes have no baseline for it until
explore profile <relation> --refresh and another snapshot; a join measured on
a column the relation no longer has leaves the baseline too. A profile older
than the relation’s last successful build, with its columns unchanged, is
rebuilt_after_profile: pinned with its row and byte counts refreshed, and
reported, since its keys and distinct counts may describe the data before the
build. Both are listed under data.baseline.profile_check.stale (25 at most, the
rest counted in elided) and named in a warning. A connection that cannot be
opened, a catalog whose read bills (Redshift Serverless, where pinning a cache
never woke the workgroup before), or a project with no manifest, leaves that half
unchecked with a reason, and a profile only that half would have caught is
pinned as it was: a snapshot that could not look never reads as one that found
nothing.
A changed declaration is drift, even with the SQL untouched. A model’s
declaration (#491) records which
rows belong, what one row is and how each measure adds up, so changing it
changes what the model’s numbers mean. maintain snapshot fingerprints it per
model and per column, one hash per field over a canonical form, so reflowing a
description or reordering a grain is not a change and no declared value lands
in .dex/. maintain semantic and maintain check report
declaration_changed (one field, with data.change of changed, added or
removed), declaration_added and declaration_removed on the semantic axis.
A change to the population, grain, additivity, unit or aggregation is high,
a description low. The comparison reads the repository and the snapshot
only, so it is free on every connector. data.declaration_drift.checked says
whether it ran: a baseline pinned before declarations were fingerprinted, or a
project format that does not read them, is false with a reason and a
warning, never an empty, clean-looking result. maintain snapshot --project-only baselines the declarations without re-measuring the warehouse.
A native semantic layer (Ossie, SLayer, Cube) is fingerprinted the same way,
from the dex block of each definition’s ai_context or meta and of its
members’, with its primary key as the grain, so a changed key is a high grain
change. Its findings carry data.layer: semantic and the vendor. With no
transformation project the status is the layer’s own; beside one, the layer’s
is under data.declaration_drift.semantic_layer and checked is true only
when both were compared.
explore semantic queries the semantic layer; transform and the semantic
group author it, and maintain semantic detects drift in it. Three backends
answer the same three subcommands through one abstraction, chosen ambiently by
semantic.vendor and semantic.deployment in .dex/config.yml (the released
semantic.backend spelling of the two is still accepted) and overridable per
command with --local / --api. Those two flags name who executes, not which
vendor: every catalog and every result reports it as execution (dex or
vendor), and that is the axis the guards read. A vendor-executed backend owns the
warehouse connection, so dex never holds a statement it could price or cap, and
every hosted result carries a warning saying exactly that.
vendor: ossie reads native Apache Ossie documents from the repository, with
no dbt project and no MetricFlow in the path. It is catalog-first because the
format is: Ossie specifies interchange metadata and not a portable query runtime,
so list answers and query and values refuse by name rather than inventing
filter grammar, join planning, and execution semantics the document’s author never
stated. --for-dimension refuses too, off the backend’s own declared
unavailable block rather than off a vendor name: Ossie states no
metric-to-dimension relationship, and answering “no metric can be grouped that
way” would be a claim about the layer where the truth is that this backend was
never told. The documents are named in semantic.ossie.files, including for an
Ossie-only repository. They are confined to the repository, and selecting Ossie
without the [ossie] extra refuses and names it. dex pins the Ossie schema by
content hash rather than by the version string the document carries, and records
that hash as the layer’s format_version in a snapshot, so a moved pin is one
semantic_format_changed finding rather than a layer of changed definitions. Keys
and relationship columns name fields and reach the warehouse through each
field’s expression. A dataset-scoped metric is listed as dataset.metric. See
references/semantic-layer.md, and references/ossie-compatibility.md for what
dex accepts, checks, links, and declines to claim under that pin.
vendor: slayer reads SLayer model files from the repository, the ones named
in semantic.slayer.models under semantic.slayer.base_dir, each validated by
SLayer’s own SlayerModel from the release the [slayer] extra pins. A file in
any format version but that release’s current one is refused before SLayer can
migrate it, and every refusal names the file and the element. list answers:
each model is a semantic model, each column a dimension keyed model.column, and
each saved measure a formula metric groupable by its own model’s columns, so
--for-dimension answers too. Measures and entities are declared unavailable,
because a saved measure declares no aggregation and SLayer has no entities; its
keys and joins reach explore through the declaration channel instead. query
and values run locally with execution: dex: SLayer renders the SQL as a dry
run and dex executes it through the same PII gate, relation pre-check, cost
handshake and columnar cap as the local MetricFlow backend, so SLayer never opens
a datasource, never reads a credential, and never touches the warehouse. A query’s
metrics are saved measures on one model, grouped by that model’s own columns, with
--where in SLayer’s own filter syntax; an ad-hoc formula is refused. DuckDB,
BigQuery, Snowflake, Postgres and Redshift are supported, and Databricks,
ClickHouse and Trino are refused with the reason. Values SLayer caches in a model file
(sampled_values) are never read. See references/semantic-layer.md.
maintain reads the same models on every axis without opening a SLayer
datasource or SLayer storage: the baseline records the SLayer release and model
format version, declared keys and join cardinality are measured on the grain
axis, and the schema axis runs SLayer’s own validate-models comparison on the
metadata dex captured, whose removals maintain reconcile plans through the
semantic slayer update route.
vendor: cube reads Cube model files from the repository, the exact paths
named in semantic.cube.files, statically and with no Node runtime, no Cube
server and no warehouse connection. Each plain-YAML cube and view is validated by
dex’s own port of Cube’s model rules (CubeValidator.ts, pinned to one Cube
release), and every refusal names the file and the element. A .js file, a YAML
file carrying Jinja, and a cube or view using extends are compiled-only: named
in the catalog’s notes and its compiled_only list (file, reason,
element), never translated. list answers. Each cube is a semantic model on
the relation its sql_table (or a plain single-table sql) names, and each view
a semantic model with no relation whose members keep the cube member they expose.
Each dimension is keyed cube.member. Each aggregating measure is a measure and
a simple (or, with rolling_window, cumulative) metric, and each calculated
measure is a ratio or derived metric over the measures it references. A
metric is groupable by its cube’s dimensions and those its declared joins reach,
so --for-dimension answers. Entities are declared unavailable: primary_key
and joins reach explore through the declaration channel instead, at confidence
1.0. query and values are governed: Cube has no SQL renderer outside a Cube
server, so dex asks the server at semantic.cube.url to render over /v1/sql
(planning, never executing), holds every member the query names to the server’s
/v1/meta first, refuses a plan from a pre-aggregation, of more than one
statement, or rendered for another warehouse, binds Cube’s parameters as literals
of dex’s dialect, and runs the statement through the governed spine in a UTC
session, execution: dex (see
Querying: Cube renders, Dex executes). maintain
runs every axis on the layer without starting a Cube server: the baseline records
vendor: cube and each compiled-only definition by its content (a change is
compiled_only_changed, never compared structurally, and a warning says so on
every run), primary_keys and each join’s relationship are measured on the
grain axis, categorical dimensions are re-counted on the semantic axis, and the
schema axis holds each member’s columns and type to dex’s own metadata, whose
removals maintain reconcile plans through the semantic cube update route. semantic cube define|update|plan authors the files, and a
declared dbt mart derives a cube of its own (see transform plan above). Selecting the vendor without the [cube] extra (the dialect
engine) refuses and names it. See references/semantic-layer.md.
vendor: databricks reads Databricks Metric View files from the repository,
the exact paths named in semantic.databricks.files, statically and with no
Databricks package and no workspace connection; dex never deploys a view. Each
file is one Metric View YAML body (the document CREATE VIEW ... WITH METRICS LANGUAGE YAML holds), named after its stem; a .sql file is refused by name.
Each body is validated by dex’s own port of the Metric View YAML 1.1 rules, with
YAML 1.2 booleans so a bare on: key stays text, a version other than 1.1
refused by name, and every refusal naming the file and the element. list
answers. Each view is a semantic model on the relation its source names (or a
plain single-table projection query), each field a dimension keyed view.field,
each single-aggregate measure a measure and a simple metric, MEASURE(a) / MEASURE(b) a ratio and any other composition derived, with the view’s
filter on every metric. A metric is groupable by its own view’s fields, so
--for-dimension answers. Entities and time grains are declared unavailable;
each join’s key pairs and arity, and each rely.at_most_one_match key on the
joined table, reach explore through the declaration channel at confidence 1.0.
query and values run governed on the Databricks connector (#1362): dex
renders SELECT ... MEASURE(<measure>) ... FROM <deployed view> GROUP BY ALL
from the catalog, finds the deployed view by its file’s stem with a
warehouse-free Unity Catalog listing, prices the statement from the base tables
the request reaches, and executes it through its own connector under
STATEMENT_TIMEOUT; values runs the PII gate first. Before anything is
priced, the deployed view is read back with Unity Catalog’s tables.get
(view_definition, no warehouse) and everything the query relies on (the
source, the filter, each member and every member it reads, a grained field’s
format, and the joins those reach) is held to the file; a difference, or a
deployment that cannot be read back, refuses (#1363). list --deployed reads
the views deployed from the files instead, with source: deployed and per-view
coverage (full, limited, refused); a plain list never contacts
Databricks.
semantic databricks define|update|plan authors the files through a stored plan,
never deploying them, and a declared dbt mart derives a view of its own (see
transform plan above).
maintain snapshot records vendor: databricks, format_version: 1.1 and each
file’s declared version (definition_versions, so a re-saved view is
semantic_format_changed for that file alone), and the layer-neutral axes read it: definition drift
on the semantic axis, each rely key and join arity on the grain axis. The
schema axis holds the views to the warehouse metadata with the four declared_*
codes, and maintain reconcile stores their removals as a semantic databricks update plan (#1259). Selecting the vendor without the
[metric-views] extra (the dialect engine) refuses and names it. See
Databricks Metric View compatibility.
vendor: snowflake reads Snowflake Semantic View files from the repository,
the exact paths named in semantic.snowflake.files, statically and with no
Snowflake package and no Snowflake connection; dex never deploys a view. Each file
is one Semantic View YAML document (what SYSTEM$CREATE_SEMANTIC_VIEW_FROM_YAML
takes and SYSTEM$READ_YAML_FROM_SEMANTIC_VIEW returns), named by its own name
(a stem that disagrees warns); a .sql file and a legacy Cortex Analyst semantic
model are refused by name. Each document is validated by dex’s own port of
Snowflake’s specification and validation rules, qualified against verify_only
on a live account, with every refusal naming the file and the element. list
answers. Every name carries its view: each logical table is a semantic model
view.table on its base_table (or a plain single-table definition query),
each dimension, time dimension and fact a dimension row view.table.member (a
fact marked kind: fact, groupable: false), each single-aggregate table metric
a measure and a simple metric, one metric over another a ratio, and any other
composition (view-level metrics included) derived. A metric is groupable by its
table’s dimensions and those its relationships reach many-to-one, so
--for-dimension answers. A single-column primary key is a primary entity and a
relationship referencing it a foreign declaration; every primary and unique key
and every key-equality relationship, with its arity, reach explore through the
declaration channel at confidence 1.0. sample_values are counted and never
surfaced. query and values are governed (#1290): Dex renders SELECT * FROM SEMANTIC_VIEW(<deployed view> DIMENSIONS ... METRICS ... [WHERE ...]) from the
catalog and runs it through the Snowflake connector under the cost guard, after
translation refusals, the PII gate, and a warehouse-free deployed-definition check that
locates the view with SHOW SEMANTIC VIEWS and refuses one whose read-back
(SYSTEM$READ_YAML_FROM_SEMANTIC_VIEW) differs from the repository on what the
query relies on; list --deployed reads the deployed views instead, with
per-view coverage. maintain snapshot records vendor: snowflake and dex’s own rule-set
revision as format_version (the format has no version key), over a canonical
form, so a view read back from Snowflake fingerprints as its file; the
layer-neutral axes read it: definition drift on the semantic axis, each key and
relationship arity on the grain axis. semantic snowflake define|update|plan
authors the files through a stored plan, never deploying them, and a declared dbt
mart derives a logical table (see transform plan above). maintain schema holds
each view to the columns and types Dex captured, and maintain reconcile cuts the
removals out of the files as a semantic snowflake update plan (#1293). Selecting the vendor without the [semantic-views] extra (the
dialect engine) refuses and names it. See
Snowflake Semantic View compatibility.
list costs no warehouse query on either backend, and neither does the reverse
lookup, which inverts the dimension list each metric already carries rather than
asking the layer a second question. values and query each execute one, and both
screen every dimension a request would touch before it is sent: on query a
flagged dimension is refused from the grouping or the filter, and on values it
refuses the command outright, since there is no aggregate to fall back to when the
whole output is values. Where only the name heuristic could screen a dimension, the
result says so, so weaker screening is never mistaken for evidence. The
field-by-field catalog contract, the two backends’ declared asymmetries, and what
dimension_scope and scoped_to mean are in
semantic-layer.md.
explore relationships and explore map accept --verify, which measures each
inferred join with one aggregate overlap probe (non-null foreign keys, orphan
count) and adjusts its confidence; the result carries verified and
orphan_fraction.
When a dev or replica schema is in scope beside its sources (the connector’s
configured dev namespace, or a schema that mirrors another’s entities and
columns), inference finds every foreign key twice over: once inside each schema
and once across them. Both commands keep each foreign key’s join to the parent
in its own schema and fold the same join to a parent of that entity in another
schema, along with every cross-schema join between two tables of one entity
(raw customers and the built stg_customers are copies, not a parent and its
child). A built
model’s foreign key therefore keeps its join to the built parent beside it, which
is the one a declaration can ref(), and keeps a join to the raw table only when
nothing was built for that entity. The notes count what was folded.
Exploration starts bare: by default the warehouse is observed as-is, and a dbt
project in the repo earns only a discovery note. explore profile,
explore relationships, and explore map accept --use-project, which folds
the project’s declared definitions into the result: relationships tests
become declared joins at confidence 1.0 (resolved against the connection’s
inventory; a declared join that matches nothing or more than one object is
reported in notes, never guessed, and a declared edge wins over the same
inferred one), a semantic model’s primary entity overrides the heuristic grain
(disagreements and contradicted unique tests land in data_quality), a
model’s own declaration (#491) folds in as described below, and
models reachable from metric definitions rank higher alongside the configured
ranking_hints. The compiled manifest resolves names exactly when present;
an uncompiled project falls back to name-based resolution and says so. A
stale manifest (older than the model sources) is noted, not trusted silently.
A model’s declaration folds in on the same flag (#498). Each profiled or
mapped object a declared model resolves to carries declaration: model,
source (manifest or yaml), grain, grain_status, population (rule
and filters, each {column, includes, excludes}), columns (each {name, role, unit, additivity, references}), elided_column_count, and
withheld_fields. The key is absent rather than null where no declaration
resolved, so output without --use-project is unchanged.
- The declared grain is reported as
grain, ahead of a semantic primary entity or a composite test, because it is the model’s own statement of what one row is.candidate_keysstays measurement-only, andgrain_statuscompares the two:proven(a measured key is exactly the declared grain),contradicted(a single declared column profiled with duplicates),unmeasured,missing_columns(the relation lacks a declared column, so the grain is not applied), orunprofiled. A data-quality note states where the grain came from whenever it differs from the measured one. - A column’s
references: <model>.<column>becomes a declared join at confidence 1.0 withdeclared_by: declaration <model>.<column>. The #491 writer renders arelationshipstest beside everyreferences, so the usual case is one edge with both sources indeclaration_sources; a test naming a different column for the same two relations is reported indata.conflicts. - The declaration is read from the repository on every run and never written to the cache: a profile served from the cache is annotated as accurately as a fresh one, and a removed declaration clears on the next run. Over a stale manifest the YAML is read instead, since a declaration is plain YAML a human edits.
- A native semantic layer is a declaration source too, with no dbt project needed.
Its
primary_keyis the declared grain at either arity, reported ahead of a measured key; an Ossieunique_keysentry, a SLayeruniqueflag and a dbtuniquetest are measured and never reported as the grain. Population, role, unit, additivity andreferencescome fromdexmetadata (ai_context.dexon Ossie,meta.dexon SLayer and Cube), and a document annotated before these were stored reports no role until it is annotated again. The metadata is untrusted text: a part of the wrong shape, or outside the vocabulary, is left out and named innotes, and the note never repeats the value. - Where a dbt model and a native layer declare one relation, the dbt declaration
is reported whole, since a layer’s is derived from it, and
notesnames both and any grain they disagree on. - Declared columns are capped at 12 per object (
explore profile --columns alllifts the cap there;explore mapbinds it in every mode), with the cut counted inelided_column_countand innotes. - A population’s values and its free-text rule are column values all the same:
values-free mode withholds the rule and every filter value. In full mode,
any filter on a PII-flagged column withholds the entire rule and that filter’s
values, at any confidence. The null fields are named in
withheld_fields.
explore relationships and explore map also accept the independent
--use-hosted-semantic-layer opt-in. It permits a configured hosted layer read;
when that layer cannot expose physical relations (as dbt Cloud currently cannot),
dex reports the partial linkage and does not invent warehouse edges or exposure.
The project’s semantic layer folds in on the same flag, in both directions,
and neither direction costs a warehouse query.
Every entity two semantic models share is a join the layer states outright, with
the physical key named per model, so those arrive as declared joins at
confidence 1.0 beside the relationships tests, through the same endpoint
resolution and the same never-guess rule. declared_by on the edge names the
entity, which is the part a reader can look up with explore semantic list and
the only part the edge does not already carry; a relationships test leaves it
unset, because it declares exactly the two columns the edge already names. An edge
both channels declare is counted once. notes says how many came from the layer
and, separately, how many of those name-based inference did not find, which is the
case that matters: the layer routinely joins columns that share no name.
In the other direction, each object in data.objects carries semantic_models,
the models that sit on that relation. Empty is an answer: a relation nothing in the
layer reads is a different object from one several metrics are built on, and row
counts and PII flags cannot tell them apart. Every object in view is rewritten
whenever the layer was read, so a model dropped from the layer clears rather than
leaving a stale claim. A project with no compiled semantic layer contributes
neither direction and is not an error on this path; explore semantic list is the
command whose subject is the layer, and it is the one that refuses by name.
A key is ranked, and the reason travels with it. candidate_keys is ordered,
tightest proven key first, so the first entry is the one grain elects and the
rest are alternatives rather than an unordered set a caller has to guess through.
key_evidence carries one entry per combination the profile considered, each with
its columns, a status of reported or suppressed, and a reason in the
profile’s own words. The reported entries are in the same order as
candidate_keys, which is the invariant that keeps the two fields from drifting;
the suppressed ones follow.
Suppression exists because unique is not the same as identifying. Where one column
is unique on all but a handful of rows, every wider column in the table completes
it, and the resulting combinations are the same fact restated: the column has
duplicates. Reporting them as keys buries the real key among filler and puts a
test in scaffolded dbt on a tuple nobody meant. So they are suppressed from
candidate_keys, kept in key_evidence with the reason, and stated once in
data_quality alongside the counts. A caller learns from key_evidence that a
probe ran and found only artifacts; that a probe never ran, or was narrowed by the
budget, is what the probe’s own notes say, and the two are not the same answer.
key_evidence is a profile field. explore map reports the best-ranked key as
candidate_key and is budgeted per object, so the full ranking belongs to the
command whose subject is one relation in full.
explore map returns the map, not a receipt for it. Alongside the counts,
data.objects carries each top-ranked object’s row count, detected grain,
best-ranked candidate key (the full ranking and the reason behind each key are
explore profile’s key_evidence, which this payload deliberately does not
carry), notable columns (each with the role that earned it a place: grain,
key, join, or a PII flag) and data-quality findings, and data.edges
carries the join edges in exactly the shape explore relationships returns them.
It is budgeted the way explore diagram is budgeted: at most 25 objects kept by
rank, 12 columns per object, 40 edges, and 5 data-quality findings per object.
Every cap binds in every mode, elided_object_count / elided_column_count /
elided_edge_count report what each one cut, and notes names the count, the cap
and the way to read the rest, so a truncated answer never reads as a complete one.
notes is always present, so an empty list is the positive statement “nothing was
elided”.
Which objects are eligible differs from explore diagram on purpose, and the two
commands share only the column selection. Every profiled object is eligible here,
including one that joins to nothing, because an isolated lookup table carrying PII
flags and an empty-table warning is exactly a finding; the diagram drops those,
since a box with no edge draws nothing. So a map can report more objects than the
diagram of the same cache draws, and the counts in the envelope always reconcile
with the objects printed beside them.
--detail widens what is eligible: every column rather than the notable ones,
and objects that were inventoried but never profiled. It lifts none of the caps.
It is deliberately not spelled --full, which on this command decides how much
gets scanned and therefore what the run costs; --detail decides only how much of
what was found comes back, and spends nothing.
No column value crosses this envelope. The cache holds min_value,
max_value and a value domain for the columns that earned them, and this command
does not read them: explore profile is where a caller asks for a value domain,
deliberately and one object at a time. PII is category and confidence, as
everywhere.
explore map never caps silently: past 50 objects it profiles the top
profile_top_n (default 25) by rank and announces the cutoff in notes
alongside skipped_count (--full profiles everything). data.skipped names
what it skipped: count, by_namespace (records of namespace and count,
largest first, each namespace being everything before an identifier’s last dot),
and objects in rank order, highest first, each list capped at 25 with the rest
counted in elided_namespaces and elided. It is always present, so count: 0
on a --full run is the positive statement that nothing was skipped, and it
changes neither which objects are profiled nor the estimate.
Elementary’s tables are left out of ranking (#1311). A project that installs
the elementary-data/elementary dbt package gets a schema of metadata tables
the package writes on every run (dbt_run_results, data_monitoring_metrics,
elementary_test_results), large enough to outrank the project’s own tables on
size. explore inventory --rank and explore map recognise them from the
warehouse alone, by their signature: a namespace holding at least three of the
package’s table names (its models at releases 0.15.2 to 0.26.1), one of them a
name only the package uses (elementary_test_results,
data_monitoring_metrics, schema_columns_snapshot, …). In such a namespace,
each object named like one of the package’s models, or like the
<name>__tmp_<timestamp> tables it leaves behind on BigQuery, is the package’s;
nothing else in the namespace is, so a project that builds the package into its
own schema keeps its own tables ranked. The project’s +schema is not read:
exploration starts bare, and a manifest parsed for the dev target names the dev
namespace, never the production one being explored. A recognised table is not
scored, not profiled by map (--full included), and not described in
data.objects or data.top_objects, even where an earlier explore profile
cached it; map keeps it in the cache as an inventory entry with no
rank_score. A profile an earlier --include-elementary run cached outside this
run’s scope is carried forward as any out-of-scope profile is, recognised by the
same signature, and left out the same way, its rank cleared. data.excluded names them: count, reason (elementary, or
null when nothing was left out), by_namespace, and objects sorted by name,
each list capped at 25 with the rest counted in elided_namespaces and
elided. It is always present on map and on a ranked inventory, and apart
from data.skipped, which is the rank cutoff’s. A note names the namespaces and
the way back. The tables stay readable: an unranked explore inventory lists
them, explore profile and explore query read them as any other, and
--include-elementary ranks them with the rest. explore diagram and
explore relationships apply the same rule (#1494), by the same signature.
The diagram reads it over the cache’s identifiers, names only, so it stays free:
a cache an --include-elementary map filled with the package’s profiles, or a
hand-run explore profile added one beside the inventory entries map keeps
for them, still draws none of them, --full included. A left-out object is never
counted as an elided entity; an edge onto one is dropped as any edge whose
endpoint is not drawn, counted in elided_edge_count, and connects nothing, so a
project table whose only join is onto one is isolated and drawn only with
--full. The signature has to be in the cache to read: a cache only
explore relationships has written holds no entry for the tables it left out (a
map keeps their inventory entries, and no later write drops them), so a lone
package table profiled by hand into it is below the signature and --full draws
it, with nothing excluded, until an explore map writes the rest.
Relationship inference leaves them out before anything is priced or profiled:
none is profiled, a metered connector’s estimate prices none, and no join among
them (their shared unique_id columns) is inferred; a profile of one the cache
already holds is left as it is, read by nothing, and the joins among them an
earlier --include-elementary run cached are dropped from the cache, as on
map, where this run listed their namespace. Carried forward from outside a
narrower --scope instead, the tables are recognised among the carried profiles,
as map recognises them, and the joins stay in the cache and out of
data.relationships; carried_relationship_count counts only the carried joins
the list reports, so it agrees with inferred_count, which is derived from the
list. Only the package’s own tables are left out, so a project
table sharing their schema is still drawn and profiled. Each command reports data.excluded in the shape map
does, always present, with a note naming the namespaces and --include-elementary
as the way back: on diagram it draws them, on relationships it profiles them
and infers joins among them. Objects skipped on a
re-map carry their prior profiles forward (carried_forward_count), each
stamped with its own profiled_at. A selected object whose cached profile is
still fresh (same connector, schema unchanged, profiled within
profile_freshness_hours, default 24; 0 disables reuse) is reused without a
re-scan and reported as cache_hit_count, so it never enters the cost preflight
or the billed handshake. --refresh forces a full re-profile of every selected
object even when the cache is fresh, for a source that changed in a way the free
metadata check cannot see. explore relationships and the standalone
explore profile <objects> reuse fresh profiles the same way
(cache_hit_count), so a profile on a table map just wrote is served free;
all three accept --refresh.
Global flags (shared resolution path): --connector, --path (DuckDB),
--scope, --project and --dataset (BigQuery only), --repo-root,
--confirm, --budget, --session-ceiling, --no-session-ceiling, and
--values-free.
--values-free runs the command in values-free mode, where no value read from a
table appears in any result, refusal, error, note or warning: explore profile
withholds min_value, max_value and value_domain, explore query accepts only
aggregate-only statements, an error carries a code instead of a warehouse’s words,
and a command not reviewed for the mode refuses. A host pins it for every command
with DEX_RESULT_MODE=values_free in the environment, and no flag turns it off;
.dex/config.yml never selects it. Every envelope the mode produces carries
data.result_mode: "values_free". The rules, the command allowlist and the
residual risks are in values-free-mode.md.
--session-ceiling <value> and --no-session-ceiling are the two answers to the
one-time cumulative-ceiling ask below. Either one writes the answer into
.dex/config.yml and reports the amendment as an update diff; they are answers
to a question about the project, not per-command overrides, which is why they are
durable and why --budget is unaffected by both. The amendment edits the budget
lines in place and nothing else, so the file’s comments, key order, and any key
this release does not read all survive it. Both answers are the person’s; a
coding agent never supplies one on its own, and nothing it reads can.
A host caps the cumulative ceiling with DEX_SESSION_CEILING_CAP=<magnitude> in
the environment (or DexEngine(session_ceiling_cap=...) on the library). There
is no flag for it and .dex/config.yml never sets it. The ceiling in force is
the lower of the cap and budget.session_ceiling, and the cap alone where the
file sets none or recorded a decline, so neither answer above and no dex config
write can raise it; one that leaves the ceiling in force unchanged is still
written, with a warning naming the cap. A capped process is never asked the
one-time question, a refusal over the capped remainder names the cap as its
source, and a value that is not a positive number refuses every command
(reason: configuration). What it protects and what it does not:
cost-controls.md.
The config verbs take none of these. They read and write the committed file
before any engine is built, so a run override would be accepted and then do
nothing; each one is refused by name instead, pointing at dex config set.
.dex/config.yml is found by walking up from the --repo-root directory (default
the shell cwd) to the enclosing git root, the way git and dbt locate their project,
so a command run from a subdirectory resolves the project’s config rather than the
current directory’s. The walk anchors on the config file (a subdirectory holding
only a .dex/ cache never shadows the real config higher up) and stops at the git
root (a stray .dex/config.yml above the repo cannot capture the session). The
config verbs find the file the same way, so they read and change the config the
next command will load. With no
config found anywhere and no explicit --connector/--path, the engine refuses
and names the fix rather than defaulting to DuckDB. A committed relative
duckdb.path resolves against the project root the config lives in, so the same
target opens from any subdirectory; a live --path stays relative to the shell cwd.
dex demo’s positional path differs because it names a file to write rather than
one to read: a relative one resolves against the --repo-root directory itself
(not the walked-up project root), so the demo writes exactly what
cd <repo-root> && dex demo would.
--scope is repeatable and narrows the source allowlist for one command. Each
connector reads it in its own namespace vocabulary: a dataset on BigQuery, a
schema, database, or database.schema on Snowflake, a catalog or
catalog.schema on Databricks, a schema on Postgres. It is never written back
to config, so connect test --scope X works before a connector block exists.
Two rules make it a cost control rather than a hint, both in
cost-controls.md: it narrows and never widens, and it is
honored or named in an error, never dropped. --project and --dataset are
BigQuery vocabulary and error on any other connector; DuckDB has no namespace to
scope and refuses all three (its target is --path).
The query firewall
explore query executes SQL the agent wrote; the engine generates nothing and
only refuses or bounds. A call may carry several statements, and the gate below
runs over each of them separately: batching buys call count and nothing else.
The gate, in order:
-
Parse, don’t trust. A single read-only SELECT per statement, structurally
checked. Writes, DDL, PRAGMA and DESCRIBE are refused (introspection goes
through
inventory/profile), and so is multi-statement input inside one string:"select 1; select 2"stays refused whether it arrives alone or alongside other arguments. Separate arguments are the supported way to ask several questions, because they keep the statement boundaries explicit instead of asking the parser to find them. A call to a function that reads outside the relations a statement names is refused by name wherever it sits, projection, FROM or subquery: server files (pg_read_file, DuckDBread_csv/read_parquet/read_text,glob), URLs and object stores (ClickHouseurl,s3,hdfs), other databases (remote,mysql,postgresql,dblink, BigQueryEXTERNAL_QUERY), and SQL held in a string (DuckDBquery, Trinosystem.query, Postgresquery_to_xml). The reason isunapproved_function. No setting lifts it,guards.approved_functionsincluded, because a setting that could would live in a file an agent may write. -
Resolve against the cache, then against the connection. Every table and
column must exist in
.dex/cache.json, because profiling is what makes the PII policy computable and the firewall cannot judge a column whose flags it does not have. That holds for every table the statement reads, not only the ones it projects from: a subquery under WHERE, EXISTS, IN, HAVING, a join’s ON or ORDER BY is resolved the same way, since a table nobody profiled is still an oracle over its values when it is only used as a filter. What follows from a cache miss is not a refusal, though: the object is looked up in the live inventory, and if the connection has it, it is profiled and the query then runs. This covers the case no amount of upfront exploration can, a relation built since the last inventory (a modeldbt runjust created), which is neither profiled nor inventoried. Three states trigger the profile: never profiled, present but inventory-only (no column detail), and profiled against a column signature the warehouse has since changed. Age does not: a cached profile whose columns still match is reused however old it is, so a probe never silently becomes a re-scan. The scan is disclosed, never silent. The result warns, naming what was profiled, anddata.profiled_on_demandlists it for a machine reader. The profile is a full one, same detection, samepii_overrides, same cache write, so the flags governing the query are the flags a deliberateexplore profilewould have produced. On a metered connector it is priced rather than implied: a single handshake covers profiling those objects and running the statements, itemized per table alongside a(the statement itself)entry (or one(statement N)entry each when the call carries several), and the confirmed call does both. A call is resolved as one set, so two statements over the same cold table pay for one scan rather than two. If the guard then refuses a statement anyway, the profile is still saved and the refusal says so, so a corrected query does not pay for it twice. An object the connection does not have is still refused, and only the statements that named it. The message names the connection rather than the cache, because no amount of profiling puts an absent object into it. A statement already refused is never scanned for: the objects worth profiling are the ones a statement that can still run will read.--no-auto-profile, orauto_profile: falsein.dex/config.yml, restores the strict prerequisite: the original refusals word for word, and no connection opened to produce them.explore clusterresolves its object the same way, with one difference in pricing that its shape forces. Its sample statement is built from the feature columns, which come out of the profile, so the profile is priced first and the sample passes a mid-command gate afterward: a budget too small for the sample returnsneeds_confirmationwith the profile already saved, rather than refusing and discarding it. -
Classify the projection. Output may carry values only from columns the
PII policy clears, which is what the profiles gathered in step 2 are for:
the firewall cannot judge a column whose flags it does not have. Which
aggregates carry a value out, what a sub-threshold flag does, and how a human
clears one are in
pii-policy.md. Filters, join conditions, GROUP BY and ORDER BY are unrestricted: values flow in, not out. -
Bound the result. LIMIT is clamped (default 50 rows), long cells are cut
(default 256 chars), the payload is byte-capped (default 16 KiB), at most 10
statements ride in one call, and every cut is announced in
notes. A watchdog interrupts queries that outlive their time budget (default 30s). All of them are configurable underquery:in.dex/config.yml;auto_profilesits at the top level instead, becauseexplore clusterhonors it too. The byte cap is the one that follows the call rather than the statement, because it is the one protecting agent context: a call answering ten statements must not emit ten times what one statement is allowed. In values-free mode a statement is first held to the aggregate-only shape (one row of allowlisted aggregates, no column-keyed GROUP BY, no DISTINCT, LIMIT, ORDER BY or window), before anything is opened or profiled, and its result is held to one untruncated row of numbers afterwards: the mode refuses rather than cuts. Seevalues-free-mode.md. -
Record. Every decision, allowed, refused, or failed, is appended to
.dex/queries.jsonl(SQL text and counts, never result values). An allowed query that projected sub-threshold flagged columns records those warnings underpii_warnings, so the audit trail keeps every such projection findable. A decision that profiled first records the objects underprofiled_on_demand(andprofile_plannedon aneeds_confirmation), so a scan is as findable in the ledger as a spend. One entry per statement whatever the call carried; a call carrying several addsbatch_indexandbatch_sizeto each and gives them all one timestamp, so an auditor can see that six statements were one authorization event rather than six. In values-free mode a refused or failed entry’sreasonis the error’s code, never its words.
columns, cells as a list of lists, row_count,
truncated, notes), which is cheaper in tokens than records and keeps the
envelope sanitizer’s list-of-dicts raw-row rule intact as a backstop.
A call carrying one statement puts that shape directly in data. A call carrying
several puts one entry per statement under data.results, each with the same
keys plus index, status (ok, refused, failed, skipped), error,
reason, stage (see the envelope rules below), and the source line when the
statement came from --sql-file;
statement_count, ok_count and failed_count sit beside them. A statement
that failed makes the envelope’s own status error while every answer stays in
data, the same way transform build reports a run that failed partway: an ok
envelope carrying a guard refusal would be the weaker claim, and dropping the
answers to report the refusal would discard work already paid for.
--across <ds,ds,...> (comma-separated, repeatable) asks one question of mirrored
environments: dev, qa and prod copies of the same datasets. Every statement names
its dataset as {ds} and runs once per target, so this is two statements in one
call:
dex explore query "select status, count(*) from {ds}.orders group by 1" --across dev_raw,prod_raw.
They are ordinary statements to everything downstream: each is adjudicated by the
firewall against its own relation’s profile and PII flags, and the whole call is
priced in one handshake and profiled once. Each entry in data.results adds
target and template (which of the caller’s statements it came from), the
entries run template by template so the variants of one probe sit together, and
data.across lists the targets in the order given. A refusal names its target
(statement 2 (target qa_raw) refused: ...). A target must be a plain dataset
name (letters, digits, _, -, dot-separated for a qualified one), since it is
substituted into the SQL; a statement with no {ds}, a repeated target, and a
call whose statements times targets exceeds query.max_statements are refused
before anything runs. A call without --across reports neither key.
The caps follow the call rather than the statement where the difference matters.
query.max_rows and query.max_cell_chars bound each statement;
query.max_payload_bytes is the budget for the whole call, spent in statement
order, so several statements cannot emit several times what one is allowed; and
query.max_statements (default 10) bounds how many a call may carry at all.
The envelope
Every command prints one object of this shape (exmergo_dex_core.envelope):
cost.unpriced names work the command runs that estimate leaves out, so any
entry makes the estimate a floor. It is null wherever nothing is claimed, which
is every command but a transform build on a billed connector that left work out
of its estimate. A build names three kinds:
- the Elementary package’s hooks or tests (#1309);
build_nodes: compiled nodes the connector could not price, usually tests and models whose inputs a cold dev target does not hold yet (#1099);verification:--verifystatements that could not be priced before the build (#1099). They are priced again after the build against the confirmed reservation and offered if they do not fit.
data.result_mode is "values_free" on every envelope, and
an error envelope adds data.code, a stable code that quotes no value (see
values-free-mode.md). Outside the mode neither key is
present.
Where a host pinned a cap on the daily ceiling, every envelope carries
data.session_ceiling_cap: {"value", "unit", "source"}, with source one of
environment (DEX_SESSION_CEILING_CAP) or host (DexEngine), and unit
null where the command resolved no connector. Without a cap the key is absent.
Rules the envelope enforces, all of them Tier-2 eval targets:
- A warehouse’s words, never a row’s value. An error, note, warning,
suppressedreason or record that relays a warehouse’s refusal keeps its words and masks the value a conversion, parse or range failure quotes (Could not convert string <value withheld> to INT32), on every connector and every surface. The policy and its limit are inpii-policy.md. - Cost before spend.
costis a preflight estimate, and any command that would spend returnsneeds_confirmationuntil it is confirmed and budgeted. The handshake in full is incost-controls.md. - An estimate says how much it is worth.
estimate_qualityisexacton BigQuery, where a dry run is what the job will bill, andapproximateon every connector that models a run instead.unknownmeans dex tried to price the work and could not, so only the ceiling and the server-side per-statement cap are still binding;nullmeans nothing was priced at all. Those last two are different states, and a caller that collapses them admits an unpriced command believing it was priced.unitspells out what the magnitude counts, derived from the paradigm so no command can report bytes and label them seconds. - The quality answers for the whole command. A dry run is exact for each
statement it prices, but a command that left work out holds a partial total.
So
estimate_qualityfollowscost.unpriced(#1099). Whereunpricednames anything,exactbecomesapproximate, the floor that the estimate is, and a total of zero becomesunknown, since a floor of zero bounds nothing. Withunpricedempty the connector’s own verdict stands, so a fully priced BigQuery build is stillexact. The rule is derived on the cost itself, so the ask, every refusal and the finished build agree, and so does the library’sResult.cost. - A priced phase the caller did not request is an offer, not a refusal. When
a command’s free half is a complete answer in its own right, the envelope is
okand the price of the optional half sits indata.offer, carrying the same estimate, breakdown, and--confirm --budgethint a refusal would.maintain checkandmaintain semanticare the two. The spend gate is unchanged (nothing runs without the confirmed re-issue) andcost.estimatestays unset, so a reader can keep treating a populatedcost.estimateon anokas settled preflight for work that ran.needs_confirmationstays reserved for work the caller asked for and has not authorized, which is the only case where dex is genuinely blocked. data.spendreports settled spend for every billed command, includingtransform build, and always matches what the same command appended to the ledger. It carries the connector’s unit (bytes_billedorseconds_billed) plussession_spent_today, which is what the next command’s cumulative ceiling will start from. A failed build reports it too: dbt bills for the statements it ran before it stopped.- And it is the only place spend is reported. No command puts a billed
magnitude anywhere else in
data, and every command that can bill carries the unit key whatever it settled at, zero included. Both halves are the same rule: a key that exists on one command and not another is worse than one that never exists, because at the top ofdataa missing key reads as a value, and the value it reads as is zero.transform buildused to stampdata.bytes_billedas well, so a caller reading that key saw a build’s spend and read amaintain checkthat had just scanned 0.89 GB as free. Under-reporting spend is the one envelope defect that breaks the cost-governance guarantee rather than annoying the caller, so where a figure is genuinely unavailable the key reportsnulland a note says why, rather than rounding an unknown down to zero. Key parity acrosstransform build,maintain check,explore query,explore mapandexplore profileis a contract test. - ClickHouse’s paradigm depends on its declared deployment. Config-free
callers retain the backward-compatible
db_loaddefault; an effectiveclickhouse.deployment: cloudusescompute_time. Cloud keeps seconds as the binding ceiling and ledger unit, and adds approximate compute-unit-hours from live per-replica memory plus optional USD from the configured price. Missing or partial capacity refuses before billed work. - Trino is guarded as
db_loadin cluster-seconds.trino.deployment: galaxyis accepted by config validation, so the committed shape is final, but refused byconnect, the dev-target preflight andtransform init, withcompute_timenamed as the paradigm it would need; aself_hosteddeclaration reaching a*.galaxy.starburst.iohost is refused too. - Spend, the ledger, and the daily ceiling are governed by
cost-controls.md. That file owns the.dex/spend.jsonlrow shape, how reservations and settlements net, the cumulativebudget.session_ceilingand its one-time ask, and what a ledger that cannot be read does to a billed command. This section states only what the envelope carries. cost.paradigmnames the connector the command ran against, not what the command happened to cost. A free metadata command on BigQuery reportsbytes_scannedwith a null estimate, so a caller learns what a billed command will cost in before running one.free_localis DuckDB’s own paradigm and a positive claim that the connector bills nothing; when no connector was resolved the field isnullinstead. A refusal carries the paradigm, the estimate, and the ceiling that bound it, so “was this refused over money?” is answerable from the structured fields without parsing the error prose.- A warehouse refusal names the door it came through. A statement the
warehouse itself refused reads
reason: execution_failure, and on a connector that can tell where the refusal happened,data.stagesays which.plan: the warehouse would not plan the statement (on BigQuery, the dry run or the job insert answered 400), so nothing ran, nothing was billed, and the same statement will be refused again until it changes.run: it planned, ran, and failed, so it may have billed, and the failure can depend on the data or on resources rather than on the SQL. BigQuery is the one connector that sets it today. The key is absent, never null, on every other error envelope: a refusal from a connector that cannot tell its doors apart, and every refusal that is not the warehouse’s. A multi-statementexplore queryreports each statement’s verdict in its owndata.resultsentry, sostagesits there beside that entry’sreason, and is null on a statement that answered, one a guard refused, and one whose connector named no stage, the same wayreasonanderrorare always present in that shape. The error text is the same whichever door it was, so a host that matched on it keeps working and one that branches on the field no longer has to. connectionnames the target that answered. Its connector, safe target coordinates, and resolution source are stamped once at the CLI boundary so individual command handlers cannot omit or reshape them. The sanitizer scans this block as well asdata; credentials remain forbidden even if a future connector accidentally places one among its target coordinates.- Diffs, not silent writes. Proposed changes appear in
diffs; being there does not apply them. The user applies through their normal review and PR flow. - The config file speaks through
reasonandwarnings. A.dex/config.ymlno command can load (it does not parse, or a value fails the schema) refuses every command exceptconfigwithreason: configuration, naming each setting and its line rather than repeating the validator’s own text. A key dex does not read, a key written twice, or a credential-like key does not refuse anything: each rides the envelope’swarnings, so a typo in a setting is never a setting that silently does nothing.dex config validatereports all of them at once, anddex config unset <key>removes one. - Two engines on one
.dex/are named, not refused. The project’s own pin ofexmergo-dex-coreis read from the nearestuv.lock(a registry entry) orpyproject.toml(an exact==requirement) at or above the dex root, up to the enclosing git repository. When it names a different release than the running engine, every envelope, theconfigverbs included, carries one warning naming both versions and the file. A dev segment and a local label are ignored, so two commits of one unreleased version agree.cache.json(provenance.tool_version) andsnapshot.json(tool_version) record the release that wrote them,nullwhere it is unknown, and never the0.0.0a build without.gitused to stamp. The explore commands that fold a prior cache into their own, and every drift axis that reads the baseline, warn when that document came from another release. A stamp ofnullor0.0.0records no claim and is never compared. - No secrets, no uncleared values.
datais scanned before printing (envelope.sanitize): a secret-like key or a record-shaped raw-row payload is a hard failure, never a silent scrub. Result values appear only inexplore query’s columnar payload, and only after the query firewall has proven they come from profiled, PII-cleared columns.diffsis not scanned the waydatais, so aconfigdiff withholds its own: any value under a credential-like name, including one on a context line, reads<withheld>. This is a release-blocking safety guarantee.
Why this is the first artifact
Because every skill, test, and benchmark depends on it, the contract was locked before the engine logic was built, and the subcommands fill in against this fixed boundary. Exploration, authoring, and maintenance are live today. Source:references/command-contract.md (edit on main). This page is generated; change the source, not the site.