You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Which packages are affected?
dbt-adapters
dbt-tests-adapter
dbt-athena
dbt-athena-community
dbt-bigquery
dbt-postgres
dbt-redshift
dbt-snowflake
dbt-spark
Current Behavior
When running dbt run with the --empty flag wildcard tables aren't able to reference the _TABLE_SUFFIX column. This is because the _TABLE_SUFFIX isn't implicitly passed through with the select *.
For example,
select
*,
_TABLE_SUFFIX as table_suffix
from {{ source('sharded_table') }}
where length(_TABLE_SUFFIX) = 8
compiles to,
select
*,
_TABLE_SUFFIX as table_suffix
from (select * from `project`.`dataset`.`sharded_table_*` where false limit 0)
where length(_TABLE_SUFFIX) = 8
Expected Behavior
If the table id ends in a *, the adapter should pass through the table suffix column for limited queries.
select
*,
_TABLE_SUFFIX as table_suffix
from (select *, _TABLE_SUFFIX from `project`.`dataset`.`sharded_table_*` where false limit 0)
where length(_TABLE_SUFFIX) = 8
Steps To Reproduce
Create a source with a wildcard table.
Reference it in a model and attempt to query the _TABLE_SUFFIX column. This query should build with dbt build <model>.
Now try dbt build <model> --empty. You'll hit an error: Unrecognized name: _TABLE_SUFFIX at ....
Is this a new bug?
Which packages are affected?
Current Behavior
When running
dbt run
with the--empty
flag wildcard tables aren't able to reference the_TABLE_SUFFIX
column. This is because the_TABLE_SUFFIX
isn't implicitly passed through with theselect *
.For example,
compiles to,
Expected Behavior
If the table id ends in a *, the adapter should pass through the table suffix column for limited queries.
Steps To Reproduce
_TABLE_SUFFIX
column. This query should build withdbt build <model>
.dbt build <model> --empty
. You'll hit an error:Unrecognized name: _TABLE_SUFFIX at ...
.Relevant log output
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: