-
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-sigma] Standardize translator signature #25432
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @benpankow and the rest of your teammates on Graphite |
1714dfc
to
543a5f1
Compare
key=asset_key, | ||
metadata=metadata, | ||
kinds={"sigma"}, | ||
deps={AssetKey(input_name.lower().split(".")) for input_name in data.inputs}, |
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.
hmmm shouldn't this mirror logic in get_asset_key
I would have expect a method like asset_key_for_name
that is called in both contexts.
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.
Updated impl a bit - in this case, the input_names
refer to upstream tables in the user's warehouse which aren't emitted as specs by the integration - they're dot-separated strings my_db.my_schema.my_table
. The names of sigma objects in get_asset_key
refer to asset specs that the integration is actually outputting, Sigma objects.
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.
Makes sense. Just have the one question about deps
case and constructing asset keys from "input name"
4b65182
to
78db26b
Compare
543a5f1
to
82bd959
Compare
python_modules/libraries/dagster-sigma/dagster_sigma/resource.py
Outdated
Show resolved
Hide resolved
78db26b
to
8fbbed9
Compare
838f536
to
fe6b6ed
Compare
8fbbed9
to
eeb1c8a
Compare
c829865
to
6429bfb
Compare
6429bfb
to
43dc0ca
Compare
f6da204
to
c20033f
Compare
def get_asset_spec( | ||
self, asset_key: AssetKey, data: Union[SigmaDataset, SigmaWorkbook] | ||
) -> 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.
Should we do something similar to PowerBI instead?
I wonder if a function with the signature def get_asset_spec(self, data: Union[SigmaDataset, SigmaWorkbook]) -> AssetSpec
would be easier to customize for users. We could call get_asset_key
in it instead.
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.
Good question - @schrockn suggested that we put the asset_key
as a parameter so that it's more clear that there is a contract that the asset key in the spec emitted from get_asset_spec
must match the asset key returned by get_asset_key
.
The integration itself would call get_asset_key
and pass the result into get_asset_spec
, e.g.
asset_specs = [get_asset_spec(get_asset_key(obj), obj) for obj in objs]
I don't have a strong preference either way
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 clarifying.
I'd be in favor of keeping the pattern without the key as a parameter for now, to ensure consistency between integrations.
If we think that passing the key as a parameter to get_asset_spec
is better, we should do it for all other translators.
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.
Updated to not pass the key for now
43dc0ca
to
2b55bc3
Compare
c20033f
to
aadbeb5
Compare
aadbeb5
to
9bc6079
Compare
df4325a
to
66a141f
Compare
66a141f
to
79e586b
Compare
## Summary Standardizes the `DagsterSigmaTranslator` format to: 1) Have a central `get_asset_spec`, `get_asset_key` method 2) Pass the `asset_key` returned by `get_asset_key` to `get_asset_spec` 3) Enforce that the key returned by `get_asset_spec` matches the input key ## How I Tested These Changes Updated unit tests
## Summary Standardizes the `DagsterSigmaTranslator` format to: 1) Have a central `get_asset_spec`, `get_asset_key` method 2) Pass the `asset_key` returned by `get_asset_key` to `get_asset_spec` 3) Enforce that the key returned by `get_asset_spec` matches the input key ## How I Tested These Changes Updated unit tests
Summary
Standardizes the
DagsterSigmaTranslator
format to:get_asset_spec
,get_asset_key
methodasset_key
returned byget_asset_key
toget_asset_spec
get_asset_spec
matches the input keyHow I Tested These Changes
Updated unit tests