-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using --empty
, adapter.get_columns_in_relation()
returns an error
#896
Comments
thanks for flagging @zeev-finaloop! we're actually aware of the issue with |
--empty
, adapter.get_columns_in_relation()
returns an error
I'm tempted to close this as the problem and solution exists outside of the dbt-utils package, but I'll leave it open for now so that users encountering the same issue may discover it here |
I found this DBT Core issue: CT-1919 Create get_column_schema_from_query macro and it looks get_column_schema_from_query macro can help with |
Here is a workaround which makes
The keys here are |
Describe the bug
The
adapter.get_columns_in_relation
anddbt_utils.get_filtered_columns_in_relation
on Snowflake are basically running the querydescribe table YOUR_TABLE
. When running dbt build/run with the --empty flag, the generated query isdescribe table (select * from YOUR_TABLE where false limit 0)
. The latter is a broken syntax query and throws an error.Steps to reproduce
Just build any macro with:
{%- set relation_column_names = adapter.get_columns_in_relation(your_model) -%}
Run
dbt build --empty -d
Expected results
List of columns
Actual results
You will get something like:
001003 (42000): SQL compilation error: syntax error line 1 at position 15 unexpected '('.
Screenshots and log output
System information
The contents of your
packages.yml
file:Which database are you using dbt with?
The output of
dbt --version
:Additional context
Are you interested in contributing the fix?
The text was updated successfully, but these errors were encountered: