-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Incorrect compilation error thrown for snapshots using check strategy and missing check_cols parameter #2787
Comments
Good call, @kingfink! I think this gets into some of the trickier code in dbt, which is where we parse files and construct type-secure dbt objects. I believe the relevant lines are here, defining I'm thinking the issue may be that, since a snapshot config missing both |
Thanks for the context @jtcohen6 ! Are there any other examples you know of (either in the dbt codebase or somewhere else) where I can see this kind of branching logic in action?
I'm guessing trying to determine the relevance similar to this function is not what we want to do here? |
@drewbanin Any chance you could give a more specific pointer here? |
So - Snapshot config validation is kind of tricky! A snapshot can either be:
A snapshot config can also be configured with a user-defined strategy, which doesn't seem to happen too often in practice. I think that is where some of the misdirection in this part of the codebase comes from. When we see a non-compliant snapshot config, it's not obvious if it's errant or if it's just a configuration for a user-configured strategy. Rather than hacking this I got some sample code working locally if it's helpful @kingfink otherwise this should be a good starting point! |
OK I took a stab at it below, is this along the lines of what you're thinking?
Thank you so much for helping me out with this @drewbanin ! |
@kingfink no joke that is actually almost exactly the diff that I made locally while testing this one :) I have some minor thoughts about this, but they're totally the kind of thing we could iterate on in the PR. At a high-level,
Just my 2 cents though - happy to litigate them in a PR if you're interested in contributing a fix for this issue :D |
@drewbanin agree with you :) Just opened a PR (and submitted the CLA...not sure if that resolves itself) |
Describe the bug
If the
check_cols
parameter is missing when using thecheck
strategy for a snapshot, a misleading compilation error is thrown:Compilation Error in snapshot snapshot_table_name (snapshots/snapshot_table_name.sql) at path []: 'updated_at' is a required property
Steps To Reproduce
Create a snapshot with the following contents:
Issue the following command:
Expected behavior
I'd expect the compilation error to be specific to the strategy used, i.e. when using
check
:Screenshots and log output
See above
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
The output of
python --version
:Additional context
I'd love to take a stab at fixing this issue if someone can point me in the right direction 🙂
The text was updated successfully, but these errors were encountered: