-
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
Store relation name in manifest's node and source objects #2837
Store relation name in manifest's node and source objects #2837
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up @franloza! Always cool when a community member preempts us in sprint work :)
It looks like there are some failing tests in 029_docs_generate_tests
. I think you'll want to add relation_name
as an expected node value here. Some of the other discrepancies in those test failures may have to do with other artifact changes that we've merged into dev/kiyoshia-kuromiya
.
Yes! You're right, I forgot to add this new value in the doc generation tests. I'm fixing these tests and discrepancies with |
…/kiyoshi-kuromiya
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on getting all tests passing, especially the quoting, which is the real end goal of this effort.
I'm not quite sold on having relation_name
defined for all node objects. In particular, it seems inconsistent for tests and for ephemeral models, which currently have null
for database
, schema
, and alias
. Is there a way we could null
out the relation_name
for those resources?
compiled_database = self.default_database | ||
if self.adapter_type != 'snowflake': | ||
compiled_database = self._quote(compiled_database) | ||
quote_database = self.adapter_type != 'snowflake' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice touch here
Hey @jtcohen6, thank you for your review!
I agree with you about this. As you say, it is misleading for ephemeral models and tests. At this point, I think there might be multiple ways of nulling the relation name for these types. Let me come up with one implementation and let's discuss it. Any feedback or hint about the implementation is welcome! |
I have considered the following criteria in my implementation to set a value for the
In addition, I missed a snapshot in the docs generation tests to verify that the relation name was the expected one. This is why I have decided to include a snapshot example in the tests. @jtcohen6 what do you think about this approach? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Tiny comment on the implementation.
Thanks for all the work around tests, and I'm really happy you added a snapshot example. Just wondering about disabling for BQ + Redshift—what's the common incompatibility?
Co-authored-by: Jeremy Cohen <[email protected]>
Thanks again for your review!
There is no incompatibility, we are testing documentation for snapshots in |
Hey @jtcohen6, finally I included the
I also modified the test to accept this new field. I did not modify the condition Finally, I added the snapshot to the tests |
@franloza This is looking great! Thanks for all the polish at the end. I'm out for a few days, so I'll take a more detailed look when I'm back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @franloza! Thank you so much for the contribution
if (node.resource_type in NodeType.refable() and | ||
not node.is_ephemeral_model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks for your review! Glad to contribute 👍 |
Resolves #2647
Description
As @beckjake mentioned in #2641 , the relation name can be obtained from the adapter at compile-time. It was only necessary to add
relation
as an optional member ofCompiledNode
class.In the tests, I added
relation_name
as the list of required keys for a compile node and values forrelation_name
in a couple of test cases (Despite the fact that it was not necessary for the test, I wanted to show this new field explicitly).In development, the
manifest.json
included the fieldrelation_name
in every node object. Example:Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.