Hi everyone,
Iām running into a strange issue in one of my ETL pipelines using dbt on Databricks, and Iād appreciate any insights or ideas. I have a query that is part of my dbt model. When I run the ETL process, the results from this query are incorrect. However, if I copy exactly the same query and run it directly from the Databricks SQL Editor, it works as expected and returns the correct results.
This inconsistency is puzzling, and Iāve already ruled out the following:
The underlying data is the same (no recent changes in the base tables).
Iāve tested both with and without the model being materialized.
The SQL syntax and logic are identical in both places.
The query is deterministic and doesnāt depend on dynamic runtime values.
I'm starting to wonder if this might be related to:
Caching, session-level context, or temp views?
Permissions or isolation between the dbt runner and my personal SQL workspace?
Some hidden state being introduced by previous dbt models?
Has anyone else experienced something similar? Any ideas on how to debug this or what could be causing the inconsistency?
Thanks in advance!