-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[components] Use AssetAttributesModel instead of DbtTranslatorParams #26768
base: master
Are you sure you want to change the base?
[components] Use AssetAttributesModel instead of DbtTranslatorParams #26768
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
def _render_property( | ||
self, key: str, raw_value: Any, value_resolver: "TemplatedValueResolver" | ||
) -> Any: | ||
return value_resolver.render_obj(raw_value) | ||
|
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.
this is easier to override on a per-key basis
174254c
to
8524932
Compare
def _render_property(self, key, raw_value, value_resolver): | ||
rendered = super()._render_property(key, raw_value, value_resolver) | ||
if key == "key": | ||
# coerce the string asset key into an AssetKey object | ||
return AssetKey.from_user_string(rendered) if rendered else None | ||
return rendered | ||
|
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.
this seems super gross and instead there should more structured and well-typed way of doing this (like a callback attached to RenderingMetadata
)
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.
Not a fan of render_property
specifically
Summary & Motivation
This converts to using the AssetAttributesModel inside the translator. This is nice because it reduces duplicated code (e.g. the AssetKey.from_user_string() conversion), and in general having fewer distinct types flying around is good. (note: the
group_name
key was erroneously called justgroup
before, this is something that we now no longer need to worry about)Unfortunately, the translator code is still a mess on account of not having a unified
get_asset_spec()
method, meaning we have to implement a bunch of individual fns. However, once that's implemented, the translator can become as simple as:How I Tested These Changes
Changelog
NOCHANGELOG