[Databricks][Fusion] [BLOCKER] Existing table dropped before enforced contract validation
I maintainer di solito rispondono entro 6 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 46/100
Direzione di ricerca
Start by tracing the Databricks table materialization and enforced-contract validation path in the adapter, then compare its operation order with dbt Core and the related issue #13654. Reproduce with an existing populated table and a contract datatype mismatch. Done means failed validation preserves the existing table, and successful replacement does not leave the target missing if creation fails.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
Major blocking issue: dbt Fusion drops an existing populated Databricks table before validating the model's enforced contract.
When running dbt run --select customer, Fusion executes DROP TABLE IF EXISTS against the existing target table before performing contract validation.
If validation fails, the existing table has already been dropped and is completely gone. This happens even though the model run fails and no replacement table is successfully created.
The DROP TABLE IF EXISTS also occurs on runs where the contract is valid.
This makes dbt Fusion unsafe for production use with Databricks table materializations and enforced contracts.
Steps To Reproduce
- Create and populate a Databricks table using a dbt model named
customer, configured withmaterialized='table'and an enforced contract. - Run the model using dbt Fusion.
- Observe that Fusion executes
DROP TABLE IF EXISTSagainst the existing target table. - Change the
sourcecolumn so that the model query returns it asstring, while the enforced contract defines it asboolean. - Run the model again using
dbt run --select customer. - Contract validation detects the datatype mismatch and the run fails.
- Check the target table: the original populated table has been completely dropped.
The same scenario works as expected with dbt Core: contract validation fails, but the existing table is not lost.
Expected behavior
Enforced contract validation should happen before any destructive operation against the existing target table.
If contract validation fails, the existing populated table must remain untouched and available to downstream consumers.
A successful replacement should also use a safe replacement strategy that does not leave the target table missing if validation or creation fails.
Screenshots and log output
Fusion error output:
09:58:53 [ERROR]: in model customer
09:58:53 Compilation Error in model customer
This model has an enforced contract that failed.
Please ensure the name, data_type, and number of columns in your contract match the columns in your model's definition.
| column_name | definition_type | contract_type | mismatch_reason |
| ----------- | --------------- | ------------- | ------------------ |
| source | string | boolean | data type mismatch |
Observed SQL execution order:
Fusion executes:
DROP TABLE IF EXISTS ...
Followed by column/datatype checks and:
CREATE OR REPLACE TABLE ... AS SELECT ...
The contract validation fails with the datatype mismatch shown above, but the original table has already been dropped.
Fusion version:
dbt-fusion 2.0.0-preview.60
Working dbt Core comparison:
Running with dbt=1.12.6
Registered adapter: databricks=1.13.0
System information
The output of dbt --version:
dbt-fusion 2.0.0-preview.60
The operating system you're using:
Windows 11
The output of python --version:
Python 3.12.10
Additional environment details:
- Execution: Databricks SQL Warehouse
- Catalog: Unity Catalog
- Adapter: Databricks
- Adapter version:
1.13.0 - Materialization:
table - Enforced contract:
true - Invocation: VS Code terminal using dbt Fusion
Additional context
This is a major blocking issue for production adoption of dbt Fusion with Databricks.
A normal enforced-contract validation failure can cause an existing production table to disappear. This can break downstream jobs, dashboards, and applications that depend on the table.
The same model and scenario work correctly with dbt Core, so this appears to be specific to the Fusion execution/materialization path.
Related issue: https://github.com/dbt-labs/dbt-core/issues/13654
That issue describes related DROP TABLE IF EXISTS behaviour on Databricks, but this report specifically highlights the destructive impact when enforced-contract validation fails.
- Lingua principale
- Python
- Stelle
- 391
- Fork
- 231
- Merge medio
- 9g 7h
- PR unite (30g)
- 29
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di databricks/dbt-databricks
-
persist_docs.columns triggers a full-plan probe query on views even when the model has no column docsForse già presa @DelorneN007 l’ha presa 59 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
databricks/dbt-databricks#1680 · 1 commento ·
I maintainer di solito rispondono entro 6 giorni
-
bug
Difficoltà 2/5 Mezza giornata Idoneità per principianti 68/100
databricks/dbt-databricks#1003 · 1 commento ·
I maintainer di solito rispondono entro 6 giorni
-
Emit COMMENT and DEFAULT for function arguments and descriptions in CREATE FUNCTIONForse già presa @alvinism l’ha presa 7 giorni fa. Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
databricks/dbt-databricks#1764 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
databricks/dbt-databricks#1761 ·
I maintainer di solito rispondono entro 6 giorni
-
Metadata queries break on catalog, schema or table names containing a quote or backslashForse già presa @MsMansiDhruv l’ha presa 14 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
databricks/dbt-databricks#1747 ·
I maintainer di solito rispondono entro 6 giorni
Tutte le issue di databricks/dbt-databricks
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
FinanceFlash/unvibecode#699 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement Website
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OWASP/OWASP-Hunting#96 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
micropython/micropython#19942 ·
I maintainer di solito rispondono entro 1 giorno
-
A rebuild posts "not part of this build" success to the commit's failed `nix-build` gate and effectsForse già presa @Padraic-O-Mhuiris l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
`epoch.Integer` raises a raw OverflowError for integers too large to convert to a floatForse già presa @arindam77 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pydantic/pydantic-extra-types#479 ·
I maintainer di solito rispondono entro 1 giorno