-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Snowflake database quoting on 0.13 #1396
Comments
Thanks for the detailed report @tayloramurphy! I will check it out |
Hey @tayloramurphy - I was able to spend some more time trying to reproduce this. It was a tricky one to diagnose! This is specifically an issue with the call to Interestingly, Still going to need to spend some more time digging in here to come up with a resolution, but wanted to hit you back with a workaround in the meantime! |
@drewbanin This worked for the snowplow package! But now I'm seeing similar behavior elsewhere. Running
Same sort of thing where the DB is not getting quoted. Let me know if you need more context / details! |
Oh wow, this is an embarrassing one. I'm going to have to make a test for it, but the fix is real obvious - this should be |
…properly Quote databases properly (#1396)
Fixed in #1402 |
Issue
Issue description
We're attempting to update to 0.13 and are unable to run dbt when testing.
The command that fails is:
dbt -d seed --profiles-dir profile --target prod
The key parts of the logs seem to be:
Results
is failing b/c the DB name is not being quoted at all. We're testing this in this MR https://gitlab.com/gitlab-data/analytics/merge_requests/881/diffs where you can see we've set
System information
The output of
dbt --version
:The operating system you're running on: Mac OSX 10.14
The python version you're using: I see this on 3.5.2 and 3.7
Steps to reproduce
In as much detail as possible, please provide steps to reproduce the issue. Sample data that triggers the issue, example models, etc are all very helpful here.
I'm able to reproduce this locally by setting my profile to:
The DB name is set based on the branch name. We know it's not valid for Snowflake but when it's quoted it's fine and this wasn't a problem in 0.12
Convo from Slack:
Is it possible that the information schema isn’t getting quoted as configured? The error I found seems linked to https://github.com/fishtown-analytics/dbt/blob/027a0d2ee6d138b5c7ae05a0b20e511e6bfdf516/core/dbt/adapters/sql/impl.py#L177 which only has a quote policy for schema and identifier.
my understanding of the code flow is that information_schema comes with the quoting policy but it appears to be overwritten? https://github.com/fishtown-analytics/dbt/blob/027a0d2ee6d138b5c7ae05a0b20e511e6bfdf516/core/dbt/adapters/base/relation.py#L139 I fully acknowledge I could be talking through my hat here lol
drew.banin
Haha, yeah, this code is super complicated 😕
The big challenge is that this logic needs to account for:
In
list_relations_without_caching
, the query that’s failing for you is actually executed via the call toexecute_macro
on L179. We then apply a quote policy to the resulting relations that are returned by the query, but I think that would happen after theinformation_schema
query succeeds.In the
information_schema
method, I think the relevant line of code is probably L147.self.quote_policy['database']
should be sourced from the adapter default (unquoted) and then overwritten with a user-supplied quote policy if provided. If there’s a bug in this code, it would probably be there!(all line numbers based on commit
027a0d2ee6d138b5c7ae05a0b20e511e6bfdf516
) (edited)So, the very quick fix is to make your database name a valid snowflake identifier (ie. use underscores instead of dashes, prefix it with a letter instead of a number).
The text was updated successfully, but these errors were encountered: