-
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] Detach spec loading from Sigma resource #25431
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @benpankow and the rest of your teammates on Graphite |
@@ -61,6 +65,9 @@ class SigmaOrganization(ConfigurableResource): | |||
default=False, | |||
description="Whether to warn rather than raise when lineage data cannot be fetched for an element.", | |||
) | |||
translator: ResourceDependency[Type[DagsterSigmaTranslator]] = Field( |
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.
hmmmm why are we making this a resource dependency? Seems like the translator should just be a vanilla object/property
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.
Right now all params on a resource must be either a config type or a nested resource, e.g.
E dagster._core.errors.DagsterInvalidPythonicConfigDefinitionError:
E Error defining Dagster config class <class 'dagster_sigma.resource.SigmaOrganization'> on field 'translator'.
E Unable to resolve config type typing.Type[dagster_sigma.translator.DagsterSigmaTranslator] to a supported Dagster config type.
E
E
E This config type can be a:
E - Python primitive type
E - int, float, bool, str, list
E - A Python Dict or List type containing other valid types
E - Custom data classes extending dagster.Config
E - A Pydantic discriminated union type (https://docs.pydantic.dev/usage/types/#discriminated-unions-aka-tagged-unions)
E
E
E If this config type represents a resource dependency, its annotation must either:
E - Extend dagster.ConfigurableResource, dagster.ConfigurableIOManager, or
E - Be wrapped in a ResourceDependency annotation, e.g. ResourceDependency[Type]
The actual passed translator can be a plain-old-python-object (a lowercase-r "resource", not a ConfigurableResource) - the ResourceDependency
here just insists that it is not treated as config.
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.
Skeptical of attaching the translator to a resource in this way as it seems confusing to me.
4b65182
to
78db26b
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.
Can we just have load_sigma_asset_specs
take a translator as an argument?
resource = SigmaOrganization( | ||
base_url=SigmaBaseUrl.AWS_US, | ||
client_id=EnvVar("SIGMA_CLIENT_ID"), | ||
client_secret=EnvVar("SIGMA_CLIENT_SECRET"), | ||
translator=MyCoolTranslator, | ||
) | ||
|
||
sigma_specs = load_sigma_asset_specs(resource) | ||
defs = Definitions(assets=[*sigma_specs], jobs=[define_asset_job("all_asset_job")]) |
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.
Given that in all the examples that the organization is just used during the load process and not attached to the actual Definitions
object I'm skeptical that it should be a resource at all. I think it adds a lot of complexity for limited benefit.
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.
to your q for discussion
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.
Decision:
- Split off translator from the resource and pass it to the load function as a separate argument. The translator is only needed during the definitions load process.
- Keep SigmaOrganization as a resource but in the examples pass it in the
resources
dictionary so that it is visible in the UI
8fbbed9
to
eeb1c8a
Compare
python_modules/libraries/dagster-sigma/dagster_sigma/resource.py
Outdated
Show resolved
Hide resolved
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 last thing: I think we should standardize on translate instance.
f6da204
to
c20033f
Compare
aadbeb5
to
9bc6079
Compare
"""Returns a list of AssetSpecs representing the Sigma content in the organization. | ||
|
||
Args: | ||
organization (SigmaOrganization): The Sigma organization to fetch assets from. |
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.
nit: can we add the docstring for dagster_sigma_translator
?
9bc6079
to
2f6818e
Compare
## Summary As part of migrating to the APIs mocked out in https://www.notion.so/dagster/Asset-integration-customization-options-11a18b92e462807c94c2f84675021120 and https://www.notion.so/dagster/Power-BI-semantic-model-API-options-11918b92e4628006a25af3f58a6b48d9, detaches the asset spec loading process from the resource. ```python resource = SigmaOrganization( base_url=SigmaBaseUrl.AWS_US, client_id=EnvVar("SIGMA_CLIENT_ID"), client_secret=EnvVar("SIGMA_CLIENT_SECRET"), ) sigma_specs = load_sigma_asset_specs(resource, dagster_sigma_translator=MyCoolTranslator) ``` ## How I Tested These Changes New unit test, updated existing unit tests.
…5431) ## Summary As part of migrating to the APIs mocked out in https://www.notion.so/dagster/Asset-integration-customization-options-11a18b92e462807c94c2f84675021120 and https://www.notion.so/dagster/Power-BI-semantic-model-API-options-11918b92e4628006a25af3f58a6b48d9, detaches the asset spec loading process from the resource. ```python resource = SigmaOrganization( base_url=SigmaBaseUrl.AWS_US, client_id=EnvVar("SIGMA_CLIENT_ID"), client_secret=EnvVar("SIGMA_CLIENT_SECRET"), ) sigma_specs = load_sigma_asset_specs(resource, dagster_sigma_translator=MyCoolTranslator) ``` ## How I Tested These Changes New unit test, updated existing unit tests.
Summary
As part of migrating to the APIs mocked out in https://www.notion.so/dagster/Asset-integration-customization-options-11a18b92e462807c94c2f84675021120 and https://www.notion.so/dagster/Power-BI-semantic-model-API-options-11918b92e4628006a25af3f58a6b48d9, detaches the asset spec loading process from the resource.
How I Tested These Changes
New unit test, updated existing unit tests.