-
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
Cache miss when alias includes explicit quotes, instead of configuring quoting: {identifier: true} #3835
Comments
@magnusfors Thanks for the really clear reproduction case! I followed the steps you outlined, with explanationThis isn't actually an error with I re-ran with cache logging turned on (
Notice that dbt doesn't know to quote the identifier. That cached relation ends up being slightly different from the relation dbt thinks it's looking for, which has resolutionUltimately, there's a significantly better way to tell dbt that you want your relations to have quoted identifiers, and it's using the project-level
Note that, when you set that config, you're setting it for all resources in your project. There's no option to have it both ways. In general, we highly recommend against setting All that said, if you set that config to quote all identifiers, and remove the next stepsThe exact reproduction case isn't a behavior I'd expect dbt to handle. That said, there's a better error that dbt should have been raising, as soon as it finds a candidate match in the cache that's approximately but not exactly right:
I can trip that error by tweaking the logic for identifying approximate (but not exact) matches, to strip the adapter quote character in addition to performing a case-insensitive comparison: if (
self.path.get_lowered_part(k).strip(self.quote_character) !=
v.lower().strip(self.quote_character)
):
approximate_match = False Is adjusting the logic, so as to trip a better error earlier on, a change you'd be interested in contributing? Otherwise, I'm going to close this issue. |
Resolved by #4076 |
Describe the bug
If updating a quoted model the dbt tests are not executed against the newly built model, instead they are deferring to the models in the previous state. For regular (non quoted) models the tests run against the correct newly built models.
In the provided example dbt 0.19.1 has been used but the same issue occurs in dbt 0.20.1.
Attached is a dbt project used to reproduce the issue (dbt_bug_project.zip)
Steps To Reproduce
cp ./target/manifest.json .
dbt clean
Please see the logs attached in the zip file. Both the quoted and the unquoted models are changed but they render different results in the log as below. They should be executing against the
AFS_DEV [dbt_bug_project.zip](https://github.com/dbt-labs/dbt/files/7077922/dbt_bug_project.zip)
schema.Expected behavior
The dbt tests should run against the latest built models and not defered to the previously built models.
Screenshots and log output
Logs found in logs/dbt.log in the attached zip file.
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
Both locally MacOS Big Sur v11.5.2 and remotely EC2 instance with AMI name amzn2-ami-hvm-2.0.20200520.1-x86_64-gp2 (i.e. Linux).
The output of
python --version
:The text was updated successfully, but these errors were encountered: