-
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
Add relation info to node_info
in logging
#7304
Conversation
core/dbt/events/types.proto
Outdated
string node_database = 10; | ||
string node_schema = 11; | ||
string node_alias = 12; | ||
string node_relation_name = 13; |
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.
@gshank @peterallenwebb Does either of you have a strong feeling around whether:
- We should prefix these with
node_
(like the other ones) - We should nest these as fields in a
relation_info
dictionary, instead of having them all as top-level fields (strings)
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.
tbh I kind of wish none of the other fields started with "node_". It feels duplicative. But that's moot, I guess :)
Nested or not I don't have strong feelings.
I wonder if we need to make these "optional" though. Did you test this with a node with database = None? The version of betterproto we were using before didn't have "optional", and google protobuf behaves a bit differently anyway. I'm not quite sure what it will do with a None passed in. Changing the event in test_events.py should tell.
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.
How about node_relation: { database='...', schema='', alias='', name: '...' }?
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.
If I pass in None
for database
, it comes back as ""
. I'll add a test for this. I think this is how proto works, right? All fields are technically optional, and there's no way to really distinguish between empty string (""
) and missing (None
), short of adding another boolean field has_database
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.
There is an "optional" thing, but it's not exactly the same as in Python, so I suspect we'd still get an empty string. betterproto was trying to be more python-like, so I think they implemented it in a somewhat more pythonic way, but I haven't done any optional fields with google protobuf yet...
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.
I went with
node_relation: {database='...', schema='...', alias='...', relation_name: '...'}
To match the nomenclature in the existing top-level node attributes, and because name
by itself feels closer to alias/identifier
tests/unit/test_proto_events.py
Outdated
"node_database": "some_database", | ||
"node_schema": "some_schema", | ||
"node_alias": "some_alias", | ||
"node_relation_name": "some.relation.name", |
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.
I updated this test. Not sure if we would want to update these functional tests as well, to ensure the field values are actually present:
* Add db, schema, alias, rel_name to node_info * Add changelog entry * Default to None * Nested node_relation message
resolves #6724
Description
Add to
node_info
dictionary another nested message/dictionary fornode_relation
, including:database
schema
alias
relation_name
(with include + quote policies applied)Checklist
node_info
includes nestednode_relation
dict docs.getdbt.com#3167changie new
to create a changelog entry