-
Notifications
You must be signed in to change notification settings - Fork 179
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
[Bug] --empty doesn't work when using get_columns_in_relation #1033
Comments
Thanks for opening @georgea-tk. I agree this is something we need to fix to fully support An immediate fix I can think of is updating {% macro snowflake__get_columns_in_relation(relation) -%}
{%- set sql -%}
describe table {{ relation.render() }}
{%- endset -%}
...
{% endmacro %} My concern with such a fix is that we'll need to make it in a variety of places, anywhere that a |
Not sure if it will be useful, but we have the same bug with relation created using DBT's |
Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#5732 |
When will this bug fix be released? Thanks! |
Is this a new bug in dbt-snowflake?
Current Behavior
The
--empty
flag changes the relation name to be something like this:(select * from DATABASE_NAME.SCHEMA_NAME.TABLE_NAME where false limit 0)
This becomes an issue when the adapter
get_columns_in_relation
function is called as it tries to do something like this, which is invalid snowflake sql:describe table (select * from DATABASE_NAME.SCHEMA_NAME.TABLE_NAME where false limit 0)
This means we get the following sql errors when using functions like
dbt_utils.star
:Syntax error: unexpected '('. (line 1)
Expected Behavior
anywhere where the
{{ relation }}
is used after a describe statement, this should be handled differently for the --empty flag to not be the subquery, but instead use the default original relation.Like here:
https://github.com/dbt-labs/dbt-snowflake/blob/main/dbt/include/snowflake/macros/adapters.sql#L30
Steps To Reproduce
--empty
command{{ dbt_utils.star() }}
macroRelevant log output
No response
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: