The problem I’m having
Using defer fails when a model selects from a {{source()}} function in the model definition. ChatGPT says that defer won’t work with sources since they are not dbt models. However, I couldn’t find anything in the official dbt documentation to verify this.
Could someone confirm if this is the case or not?
If so, are there any common workarounds for this or do sources need to be turned into models?
The context of why I’m trying to do this
For UAT testing in order to use production data for testing.
What I have done so far
- dbt docs search
- internet search
- StackOverflow search
- Asked ChatGPT
Example Model Code
SELECT *
FROM {{source(some_source)}}
Example error messages
dbt run --models model_that_uses_source --defer --state prod-run-artifacts
Runtime Error in model model_that_uses_source (models/dim/model_that_uses_source.sql)
404 Not found: Dataset my_gcp_project:my_schema was not found in location US;