-
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
[CT-2699] [Feature] "interactive" compile should include the compiled code of a snapshot #7867
Comments
Thanks for reaching out @nathangriffiths-cdx ! Is your request basically that the SQL for snapshots would be written to |
Yes, that's correct. I was actually unaware this didn't already happen until some engineers we were training on dbt tried to find the compiled SQL for snapshots and asked me where it was. This is inconsistent with other dbt models and a bit confusing for new users. |
It looks like we explicitly exclude snapshots & seeds: dbt-core/core/dbt/compilation.py Lines 552 to 564 in 9836f7b
This makes sense for seeds, since they aren't actually "compiled." For snapshots, it looks like this logic goes way back, all the way to when they used to be called That's still a problem today, because multiple snapshots can share the same dbt-core/core/dbt/parser/snapshots.py Lines 24 to 26 in 9836f7b
This feels like one more paper cut associated with snapshots being the only runnable node type that's defined in a Jinja block, and can have multiple per file, rather than just one node definition per file. I'm sure we could find some reasonable way to make this work, such as by making I'm going to label this one
In the meantime: While I understand it's inconsistent, it does feel like an improvement that "interactive" |
Is this a new bug in dbt-core?
Current Behavior
With dbt 1.5 the
compile
command was extended to allow "interactive" compilation of an arbitrary node by using syntax similar to :dbt compile --select name_of_node
In our testing we found this seems to work for all types of node, including snapshots.
However, the vanilla operation of
dbt compile
does not support snapshots. The documentation states "dbt compile generates executable SQL from sourcemodel
,test
, andanalysis
files." i.e. it does not include snapshots and indeed ifdbt compile
is run for a project no code files are created for snapshots in "/target/compiled/..".This has created an inconsistency where one usage of
compile
will generate output for a snapshot but another will not.This is not a bug as such but I think the inconsistent behaviour is potentially confusing for users, and it's not clear why standard
compile
doesn't already work for snapshots since it is apparently possible based on the interactive version.Expected Behavior
All usages of
dbt compile
should produce compiled code for snapshots i.e. non-interactive uses ofcompile
should generate the same compiled code as interactive use.Steps To Reproduce
dbt compile
dbt compile --select <name_of_snapshot>
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
bigquery
Additional Context
No response
The text was updated successfully, but these errors were encountered: