-
|
I'm experiencing an issue where dbt reports a successful build, but the created database object actually contains errors that only surface when queried. dbt run output (reports success): Actual database error (when querying the view): The "database" is Databricks. The code causing the issue: -- This creates a view that compiles successfully but fails at query time
union all
select
objectid as object_id,
CAST(activity_check AS INT), -- Contains string data that can't be cast to INT
-- ... other fields ...
from table_v2My questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
A view has a separate existence from any data that it processes. In a sense, it's the table you're reading from in the view that has violated the contract the view is expecting. This is why view creation is fast, because it doesn't actually read the data at creation time. |
Beta Was this translation helpful? Give feedback.
-
|
To answer the latter questions:
Yes. 🙂 One way with The simpler approach if you just want to confirm that each # in dbt_project.yml
models:
...
+post-hook:
- '{%- if model.config.materialized == 'view' %} select * from {{ this }} {%- endif %}`This will then attempt to |
Beta Was this translation helpful? Give feedback.
A view has a separate existence from any data that it processes. In a sense, it's the table you're reading from in the view that has violated the contract the view is expecting. This is why view creation is fast, because it doesn't actually read the data at creation time.