dbt Implementation Mistakes: Fix Stale Models, Incremental Errors and Fragile Deployments
A green dbt run proves that the selected work completed under its configured checks. It does not prove that yesterday's refund reached revenue, that an old invoice received a new field, or that tomorrow's job will still have enough hosted build allowance to run. A dependable implementation tests those operating assumptions directly.
On this page
What should a dbt implementation deliver?
Choose a recurring business decision and trace the smallest model graph that supports it. For a marketing team, that might be paid acquisition to qualified pipeline or a daily view of net collected revenue.
Write the output grain, source of truth, freshness requirement, treatment of corrections and an accountable owner for each output. A model named revenue without those decisions is unfinished even if its SQL compiles.
At Martechdevs, we scope data warehouse implementation around that output, its acceptance cases and the person who will operate it. I would make a replayed correction part of the first acceptance test, before adding more models.
Separate five failure types when investigating a messy project: source availability, transformation logic, model selection, execution environment and operating cost. Changing a materialization cannot repair a missing upstream export. Increasing a hosted allowance cannot make an incremental filter capture late corrections.
For a new model, follow the incremental model build and test workflow. It separates first-run behavior from later updates so you can locate the failure before changing production logic.
A dbt handover needs more than a successful run. Prove the output against representative corrections, verify that selectors preserve both tests and data refreshes, and use a fresh production session before accepting the schedule and recovery process.
Read diagram as text
- Define the output contract and representative inputs to Expected full and incremental results agree?.
- Expected full and incremental results agree? to Repair the source or model contract and retest: No.
- Repair the source or model contract and retest to Expected full and incremental results agree?.
- Expected full and incremental results agree? to Test selectors deployment and unchanged-code refresh: Yes.
- Test selectors deployment and unchanged-code refresh to Required models and protective tests still run?.
- Required models and protective tests still run? to Correct selection deployment or state artifacts: No.
- Correct selection deployment or state artifacts to Test selectors deployment and unchanged-code refresh.
- Required models and protective tests still run? to Test fresh production access and the actual schedule: Yes.
- Test fresh production access and the actual schedule to Access allowance and recovery checks pass?.
- Access allowance and recovery checks pass? to Repair connection capacity or operating coverage: No.
- Repair connection capacity or operating coverage to Test fresh production access and the actual schedule.
- Access allowance and recovery checks pass? to Hand over the accepted output and recovery evidence: Yes
For a marketing or revenue project, investigate the following failures before build-count optimisation. Their priority follows the effect on the business output, rather than the number of files involved.
| Symptom | Likely mechanism to test | Evidence required before publishing |
|---|---|---|
| Last month's corrected invoice is still wrong | Incremental selection missed an old record | The accepted revision reaches the final invoice key |
| Duplicate customers reach an audience | A selector omitted the protective test | Deliberately bad fixture data fails the intended check |
| Older customers have an empty new field | Schema change was deployed without a history policy | Agreed historical coverage reconciles after the backfill |
Why do old corrections disappear from incremental models?
An incremental filter based only on creation time misses changes to older records. An invoice created last month can be corrected today; selecting only newly created invoices leaves its accepted value stale.
Use the backfill procedure to recompute the affected periods and reconcile the repaired output.
Separate occurrence time, source update time and ingestion time. Define which timestamp is trustworthy for identifying changed records. A lookback window can absorb ordinary delays, but it needs a measured rationale and a way to repair changes outside it. Three days is not a universal guarantee. Plan an explicit repair path for corrections that arrive weeks later.
Then define how changes become one current record. dbt's unique_key reference explains matching incoming records to existing rows. The key configuration does not replace uniqueness and non-null tests. A source can still deliver duplicate versions or ambiguous keys.
Use a namespaced business key where identifiers repeat across accounts. For invoices, (billing_account_id, invoice_id) is safer than assuming an invoice ID is globally unique. Resolve competing versions deterministically using authoritative revision information where available. A late-arriving old revision must not overwrite a newer accepted state simply because it arrived later.
Document delete behavior too. A record absent from the latest extract might be deleted, excluded by a source filter or missing because the extract failed. Those cases should not all trigger the same action. Prefer explicit deletion evidence where the source supports it, and test the downstream financial treatment.
The available incremental strategies vary by adapter and version. Row-level merge and partition replacement have different semantics. Choose from the actual correction and deletion requirements, then inspect the compiled operation rather than copying another warehouse's configuration.
How do you prove that incremental and full results agree?
Use a frozen, representative input containing a new record, a late correction, a replay, a deletion marker, a refund and identifiers reused by different source accounts. Build the expected full result and the incremental sequence in isolated test relations.
A useful hypothetical fixture uses these cases. Monetary amounts are integer USD cents for a single invoice; they are test inputs, not customer results.
| Input change | Expected current record | Failure it exposes |
|---|---|---|
| Account A, invoice 7, revision 1, amount 10,000 | A/7 appears once at 10,000 | A new record omitted or duplicated |
| A/7, revision 2, amount 8,000 arrives later | A/7 becomes 8,000 | Creation-date filtering misses a correction |
| Replay revision 2, then deliver old revision 1 | A/7 remains once at 8,000 | Replay duplication or arrival-order overwrite |
| Account B also has invoice 7, amount 3,000 | B/7 remains separate from A/7 | Unnamespaced keys merge unrelated invoices |
| A/7 receives an authoritative deletion marker | A/7 follows the agreed deleted-state policy | Absence and explicit deletion are conflated |
| A correction predates the normal lookback | The bounded repair produces the accepted revision | Routine refresh cannot repair old history |
The following original singular data test compares two example QA models. Create those models first from the same fixture and agreed invoice contract. Both must have unique, non-null account and invoice keys. net_amount_minor is an integer in the currency's minor unit; is_deleted is an explicit state, not inferred from absence.
Save this as a singular SQL test in the project's test directory. It returns missing or different records:
SELECT
COALESCE(a.billing_account_id, e.billing_account_id) AS billing_account_id,
COALESCE(a.invoice_id, e.invoice_id) AS invoice_id
FROM {{ ref('qa_invoices_incremental') }} AS a
FULL OUTER JOIN {{ ref('qa_invoices_expected') }} AS e
ON a.billing_account_id = e.billing_account_id
AND a.invoice_id = e.invoice_id
WHERE a.invoice_id IS NULL
OR e.invoice_id IS NULL
OR a.net_amount_minor IS DISTINCT FROM e.net_amount_minor
OR a.currency IS DISTINCT FROM e.currency
OR a.invoice_status IS DISTINCT FROM e.invoice_status
OR a.is_deleted IS DISTINCT FROM e.is_deletedThis pattern uses null-safe comparisons documented for BigQuery and Snowflake. Adapt it to your warehouse and contract. It does not generate the fixture or implement the incremental strategy for you. Test the comparison with the synthetic rows, then verify the configured materialization against the same expected output.
dbt data tests report rows that violate an assertion; zero rows means this comparison passed. Include independent expected values, because an incremental model and a full model can share the same wrong business logic. dbt unit tests can exercise model logic with controlled inputs. For an incremental model, their expected output is the batch to merge or insert, rather than the complete resulting table. A sequence of actual incremental runs checks the final materialization behavior. Use both where the distinction matters.
Rerun the identical input and confirm nothing duplicates or changes unexpectedly. Then add a correction outside the normal lookback and verify the documented repair path. That final case tests the limitation your normal schedule cannot solve.
Why can a cheaper dbt job stop testing important views?
Excluding view builds with a selector can also omit tests unless the selection keeps them explicitly. Check both responsibilities when reducing repeated warehouse work.
A normal warehouse view reads its underlying data when queried; recreating an unchanged definition on every refresh is not always necessary. That does not mean every view can be excluded from every job.
Compiled view definitions can depend on source-driven macros, such as SQL generated from changing categories. Code changes also need deployment. dbt's cost-optimization guide distinguishes excluding view materialization from retaining view tests and deploying changed definitions.
Inventory why each repeatedly rebuilt view exists. Is it a stable projection? Does its compiled SQL change with source values? Which tests must still run when the underlying data changes? Which deployment job publishes its new definition?
Test the proposed selector by inspecting what it selects and what it omits. Verify both the model nodes and the tests that protect their outputs. A lower build count is not a useful optimization if it also removes the only check for duplicate customer IDs. Make the expected checks explicit in the selector review.
For a useful acceptance exercise, change a view expression in a development branch and confirm the release path updates it. Separately introduce a bad fixture row and confirm the retained test catches it without requiring every view definition to be rebuilt. Those are different responsibilities and should have separate evidence.
Why is a new column empty in historical rows?
The on_schema_change setting controls schema handling for incremental models. It does not decide the historical meaning of a newly added field. dbt's incremental configuration guide states that these behaviors do not backfill new-column values in existing records, and that schema-change tracking is limited to top-level columns.
Suppose you add acquisition_channel to an incremental customer model. New or reprocessed customers may receive a value while older rows remain empty. A dashboard can then show an apparently improving attribution rate that is actually the boundary between old and newly processed records.
Choose the historical policy before deploying: populate all recoverable history, populate a documented period, or leave earlier values explicitly unavailable. Estimate the work, verify the underlying source still exists and decide which downstream reports require restatement.
For a controlled contract, failing on unexpected schema changes may be preferable to automatic synchronization. For a reviewed additive change, an append or synchronization option may fit. Neither choice replaces a backfill plan. Nested structures need their own checks because a top-level schema check does not describe their internal changes.
A full refresh is a rebuild, not a harmless retry. Establish the affected models, required source history, permissions, cost and recovery path first. A trailing descendant selector can enlarge the scope substantially. Run a bounded comparison in an isolated environment before replacing an important production relation.
There is also a current compatibility trap: the incremental guide warns about Snowflake column-size changes affecting older dbt-snowflake adapters when models combine collation with sync_all_columns. It points v1 users to version 1.10.6 or later and identifies compatible platform tracks and v2. Check that specific condition before blaming your new field for an adapter failure.
What does the hosted model allowance actually count?
The hosted allowance counts eligible successful model builds, including repeated executions of the same model. The Developer plan included 3,000 builds per calendar month. Its billing documentation says subsequent runs are cancelled after that allowance is exceeded, until reset or upgrade. Account entitlements can differ under older terms. Check the actual account before making the free plan a production dependency.
The relevant meter is eligible successful builds, not the number of SQL files. dbt's pricing definition includes deployment orchestration, CI and API-triggered builds. Views, tables and incremental models count. Development builds, tests, seeds, snapshots and ephemeral models do not count toward this meter. Successful models in a job that later fails still count.
The following hypothetical schedule uses eighteen eligible models and a thirty-day month, plus fifteen CI runs of six models. Units are successful builds per month, not USD or distinct SQL files. The example uses the 3,000-build Developer allowance and excludes dbt State reuse and other usage meters.
| Schedule | Production builds | CI builds | Total builds/month | Position against 3,000 |
|---|---|---|---|---|
| Eight full runs daily | 18 × 8 × 30 = 4,320 | 15 × 6 = 90 | 4,410 | 1,410 over |
| Four full runs daily | 18 × 4 × 30 = 2,160 | 15 × 6 = 90 | 2,250 | 750 remaining |
Four runs daily fit this example only if the business accepts that freshness and the remaining allowance covers retries and other work. An eighteen-file repository can otherwise exceed the monthly allowance through its schedule alone.
When dbt State reuses eligible models, the billing documentation separates that reuse from successful builds and meters daily active target tables. Include dbt State usage in the actual account forecast; a skipped rebuild is not a general promise of zero platform cost.
Do not reduce freshness solely to fit a plan. Identify which outputs need frequent refreshes and select their necessary dependencies. Then compare a suitable hosted plan with the real operating cost of running locally. The free engine still needs scheduling, credentials, monitoring and maintenance. Our guide to free dbt and hosted costs separates those choices.
Why can an unchanged project leave new source rows unprocessed?
State comparison checks changes to project code, configuration and relevant metadata. It does not detect that twenty new purchases landed in an unchanged source table. A scheduled job using only state:modified can succeed while building nothing.
Use code-change selection for the appropriate CI or deployment purpose. Use a data-refresh selection or a deliberately configured data-aware orchestration mechanism for recurring production updates. Do not treat those mechanisms as interchangeable. dbt's state comparison caveats explicitly describe this scheduled-job failure.
Preserve the comparison manifest separately from the directory the current parse writes into. Otherwise you can overwrite the evidence you intended to compare against. Record which successful deployment produced the state artifact and keep it associated with that version.
Also inspect deferred references. A test with multiple parents can combine a modified development relation with an unmodified production relation. If the development data is sampled, a relationship failure may reflect inconsistent populations rather than broken production logic. Design the fixture and reference behavior deliberately; do not remove the relationship test simply to obtain a green run.
Acceptance should include two runs: one with changed code and one with unchanged code but new source data. Confirm that the intended models and tests run in each case and that the production output becomes fresh.
How should you separate an engine upgrade from a model redesign?
Pin the current working environment before migration: engine, adapter, packages, profile configuration, job commands and target behavior. Keep the production baseline available while evaluating the new runtime in isolation. Use risk-tiered change review so a revenue-model change receives appropriate evidence and approval. dbt's workflow guidance also calls for version control and separate development and production targets.
The current v2 upgrade guide requires attention to supported adapters and authentication, package compatibility and deprecated behavior. Parsing is stricter in several areas, so a previously deferred error can appear earlier. That is a reason to investigate the failing construct, not automatically disable validation.
Work through one failure class at a time. Confirm connection support, resolve deprecations, inspect package compatibility, parse and compile, then run representative models and tests. Compare output grain, types, null handling, grants and incremental updates. A compiler success is not a data-equivalence result.
Avoid changing metric definitions during the same evaluation. If revenue changes while the engine, package and business logic all change, identifying the cause becomes much harder. Establish runtime equivalence first, then release intentional business changes with their own expected differences.
Record the rollback procedure and the artifacts needed to execute it. A previous executable is insufficient if deployment also changed table schemas or state artifacts. The recovery plan needs to cover the data and configuration the old runtime would encounter.
Why should you inspect Snowflake authentication before changing dbt SQL?
A deployment can fail because the warehouse rejected its authentication before any model ran. Compare the dbt error with Snowflake login evidence and the account's enforcement timing.
Snowflake's authentication rollout moves legacy service users away from password sign-in on an account-specific schedule. A password reset does not fix an authentication method that is no longer permitted.
Check the method supported by your actual dbt engine, adapter and deployment environment. Update the connection through the approved credential-management path, then test a fresh session under the production role. A developer's interactive SSO session does not validate an unattended deployment identity.
Keep secrets out of project files and troubleshooting screenshots. Record credential ownership and rotation steps, but not the secret values. After authentication succeeds, verify object permissions and the target database and schema independently. Our Snowflake implementation troubleshooting guide provides the account-level diagnostic sequence.
What does a free dbt installation permit your product to do?
Permitted use depends on the distribution and applicable terms. Specify the version your team runs. The licensing FAQ distinguishes Apache 2.0 dbt OSS from the full distribution under the Product Licensing Agreement. The former fifteen-user limit for the free VS Code extension no longer applies. Old summaries of pre-release licensing are not a reliable implementation specification.
Internal transformation, exposing resulting data to customers and embedding a general-purpose transformation workflow are different product designs. The FAQ discusses those examples separately. Do not assume that building customer-facing software is always prohibited, or that a free installation gives unrestricted redistribution rights.
For an embedded product, review the current Product Licensing Agreement against the intended customer experience, including its redistribution and platform-access conditions. Put the selected distribution, version and applicable terms in the architecture record. Resolve the product-specific interpretation before shipping that integration.
What evidence should pass before handing over the project?
Handover should demonstrate correct outputs, retained checks, a suitable schedule and a recovery procedure another operator can follow. Every model should have a purpose, grain, owner and consumer. A staging layer that stabilizes source names and types can earn its place. Five pass-through layers created because another company's repository has five layers need a clearer reason.
Review unused models and duplicated definitions before adding new abstractions. Build reusable logic when a real second consumer needs it, and keep the first important output understandable to the person operating it. The marketing warehouse design guide provides a practical source-to-output structure. Use the first ten models worth building to scope the initial output, then gate downstream reverse ETL syncs on passing tests before activating its records.
Compare when to add Elementary or a managed observability tool with the evidence your existing checks already supply. Use AI triage for failed dbt tests and stale sources when gathering the cause across systems is the remaining bottleneck.
Estimate delivery by the unresolved decisions and required operating cycles. A small project with reliable sources and agreed metrics is different from a repair involving missing history, ambiguous identity and undocumented revenue rules. Ask a partner for a bounded scope with acceptance evidence and handover, not a promise based only on model count.
Checklist
- Each published model has a clear grain, owner and business consumer.
- Hosted build usage is forecast from actual selection and run frequency.
- View exclusions retain required tests and a code-deployment path.
- Schema changes include an explicit historical backfill decision.
- Incremental behavior covers corrections, replay, deletes and late data.
- Independent expected results and incremental/full comparisons pass.
- New source data refreshes output even when no code changed.
- State artifacts and deployment targets remain separate and traceable.
- Engine migration preserves the agreed output contract.
- Fresh production authentication and role permissions have been verified.
- Distribution and licensing fit the intended product use.
- Another team member can recover a failed run without inventing the procedure.
For a defined repair, request a detailed dbt implementation scope with the failing output, source history and acceptance cases. Want a second pair of eyes on your stack? Book a free call around the model or handoff that is holding up the next decision.
Keep reading
Browse all Data Warehouse guides
Data Warehousedbt Incremental Models for Marketing Data: Choose the Strategy Before the First Run
Choose a dbt incremental strategy for ad spend, events and CRM updates. See a DuckDB model, key and lookback checks, adapter differences and rerun tests.
Jafrin Akter AloLast updated 13 min read
Data Warehousedbt Tests for Marketing Data: 12 Checks With SQL and YAML Examples
Build a dbt test suite for spend, CRM and billing data. Copy SQL and YAML examples, catch missing rows, set severity and prove the release gate works.
Jafrin Akter AloLast updated 12 min read
Data Warehousedbt Incremental Backfills: Repair History Without Breaking Today's Reports
Plan reliable dbt backfills with affected-group recomputation, full refresh and microbatch guidance, validation fixtures and downstream release checks.
Jafrin Akter AloLast updated 12 min read
dbt implementation
See the setup scope, acceptance checks and handover.
Questions people ask
Which evidence should survive a failed dbt job?
Keep the command, selected models and tests, code version, target, timestamps, logs and affected output state. Preserve the last usable state artifact separately from the failed run's artifacts. Record whether any models published before the failure. That distinction helps the next operator choose a bounded retry instead of assuming the whole graph stayed unchanged.
Can two scheduled jobs safely update the same incremental output?
Only after their overlap and recovery behaviour have been tested for the chosen warehouse and strategy. Two schedules can select overlapping changes or compete to replace an output. Give one owner responsibility for coordination, prevent unintended overlap, and test an interrupted run followed by a retry. A shared model name alone does not establish safe concurrency.
What if a source has no trustworthy update timestamp?
Use another supported change signal, a comparison of bounded snapshots, or a deliberate re-extraction policy. First establish what the source can prove about updates and deletions. An ingestion timestamp identifies arrival, which may include older revisions. Document what history the chosen method can miss and how an operator detects and repairs that gap.
What should happen to downstream audiences after a revenue test fails?
Hold the affected activation until its owner understands the failure and the approved fallback. A previous successful audience may be stale, while publishing a partial replacement may remove valid customers. Define that choice before an incident, including consent updates that must still propagate. Resume from a reconciled output and check the destination's actual accepted state.
Who should approve a historical revenue restatement?
The owner of the reported revenue definition should approve the expected change, with the data owner documenting which records and periods are affected. Preserve the previous result, reason, reconciliation and downstream reports that need refreshing. A technically successful backfill does not decide whether leadership should compare the revised number with an unrevised historical dashboard.
Sources
- dbt: Plans and billing.
- dbt: Successful models built and usage.
- dbt: Optimize build costs and retain view tests.
- dbt: Incremental configuration and schema changes.
- dbt: unique_key reference.
- dbt: Adapter-specific incremental strategies.
- dbt: Data tests.
- dbt: Unit tests.
- dbt: State comparison caveats.
- dbt: Upgrading to v2.
- Snowflake: Authentication rollout.
- dbt: Licensing FAQ.
- dbt: Product Licensing Agreement.
- dbt: State reuse billing.
- dbt: Workflow best practices.
- Google Cloud: BigQuery comparison operators.
- Snowflake: Null-safe distinct comparison.

Written by
Jafrin Akter AloData Engineer and Co-founder at Martechdevs and Growth and Analytics Partners
Jafrin writes practical guides to marketing technology, customer data, analytics and AI workflows. Martechdevs is a Growth and Analytics Partners company.