-
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
[dagster-tableau] Update custom translator example in Tableau docs #26029
[dagster-tableau] Update custom translator example in Tableau docs #26029
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Deploy preview for dagster-docs ready! Preview available at https://dagster-docs-2sgq2rhwi-elementl.vercel.app Direct link to changed pages: |
1afa7bc
to
142f9ce
Compare
fed411e
to
5dfc4b2
Compare
# We create the default asset spec using super() | ||
default_spec = super().get_asset_spec(data) | ||
# We customize the metadata and asset key prefix for all assets, including sheets | ||
return replace_attributes( |
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.
Do we want to use default_spec.replace_attributes
, once that merges?
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 think we can reduce the verbosity of this a bit once that merges - no need to set default_spec
& can just do return super().get_asset_spec(data).replace_attributes(....)
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.
Do we want to use default_spec.replace_attributes, once that merges?
Definitely - it's mentioned in the PR description, but I could have added a comment here to make it clearer. I will wait for #25941 to land before merging the PR stack.
I think we can reduce the verbosity of this a bit once that merges - no need to set default_spec & can just do return super().get_asset_spec(data).replace_attributes(....)
I think it works if we keep the comment and note after the code snippet.
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 think we can reduce the verbosity of this a bit once that merges - no need to set default_spec & can just do return super().get_asset_spec(data).replace_attributes(....)
Actually, we reuse default_spec
in the parameters of replace_attributes
, so we should keep super().get_asset_spec(data)
and replace_attributes(....)
to avoid calling super()
again to access the asset key. Otherwise we get this:
return super().get_asset_spec(data).replace_attributes(
key=super().get_asset_spec(data).key.with_prefix("my_prefix")
)
Also, having default_spec = super().get_asset_spec(data)
puts the emphasis on creating the default spec first.
# We customize the team owner tag only for sheets | ||
return replace_attributes(default_spec, owners=["team:my_team"]) | ||
|
||
def get_asset_spec(self, data: TableauContentData) -> dg.AssetSpec: |
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.
Does it make sense for a user to want to override both get_asset_spec
and get_sheet_spec
? I find this a little confusing since I would imagine the typical case would be to either override one or more of the "object-level" spec methods, or just get_asset_spec
?
Maybe we ought to just consolidate on overriding get_asset_spec
?
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.
That's fair - will update
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.
Done in 5eeb24c
142f9ce
to
43ea996
Compare
5dfc4b2
to
5eeb24c
Compare
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.
One tiny copyedit, otherwise looks good to me!
@@ -104,17 +104,18 @@ defs = dg.Definitions(assets=[*tableau_specs], resources={"tableau": tableau_wor | |||
|
|||
### Customize asset definition metadata for Tableau assets | |||
|
|||
By default, Dagster will generate asset keys for each Tableau asset based on its type and name and populate default metadata. You can further customize asset properties by passing a custom <PyObject module="dagster_tableau" object="DagsterTableauTranslator" /> subclass to the <PyObject module="dagster_tableau" method="load_tableau_asset_specs" /> function. This subclass can implement methods to customize the asset keys or specs for each Tableau asset type. | |||
By default, Dagster will generate asset specs for each Tableau asset based on its type and populate default metadata. You can further customize asset properties by passing a custom <PyObject module="dagster_tableau" object="DagsterTableauTranslator" /> subclass to the <PyObject module="dagster_tableau" method="load_tableau_asset_specs" /> function. This subclass can implement methods to customize the asset specs for each Tableau asset type. |
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.
By default, Dagster will generate asset specs for each Tableau asset based on its type and populate default metadata. You can further customize asset properties by passing a custom <PyObject module="dagster_tableau" object="DagsterTableauTranslator" /> subclass to the <PyObject module="dagster_tableau" method="load_tableau_asset_specs" /> function. This subclass can implement methods to customize the asset specs for each Tableau asset type. | |
By default, Dagster will generate asset specs for each Tableau asset based on its type, and populate default metadata. You can further customize asset properties by passing a custom <PyObject module="dagster_tableau" object="DagsterTableauTranslator" /> subclass to the <PyObject module="dagster_tableau" method="load_tableau_asset_specs" /> function. This subclass can implement methods to customize the asset specs for each Tableau asset type. |
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.
Done in b80eee2
43ea996
to
2ac721a
Compare
7268d91
to
b80eee2
Compare
2ac721a
to
de029db
Compare
b80eee2
to
c34154e
Compare
de029db
to
3c9210b
Compare
c34154e
to
3abd4e3
Compare
3abd4e3
to
4d3e03e
Compare
## Summary & Motivation Like #26029 but for Sigma
Summary & Motivation
Update the custom translator example in the Tableau docs to reflect
get_asset_spec().key
.This PR stack will be merged after #25941 lands, so that
replace_attributes()
can be called asAssetSpec().replace_attributes()