-
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
[embedded-elt][sling] passing translator and replication config from decorator using metadata #20564
Conversation
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Show resolved
Hide resolved
48b4026
to
df8a236
Compare
@sling_assets( | ||
replication_config=replication_config, | ||
dagster_sling_translator=DagsterSlingTranslator(), | ||
) | ||
def my_assets(context, sling: SlingResource): | ||
yield from sling.replicate( | ||
context=context, | ||
replication_config=replication_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.
@PedramNavid , while updating the examples I realized that replication_config
also requires two definitions. I can take a stab at applying the same treatment here.
I also noticed that in all of the examples we showed passing the translator in the replicate
call. Hopefully moving it to the decorator isn't too burdensome for the users.
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've done the same thing with replication_config
in this commit: 26f4e14
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/asset_decorator.py
Outdated
Show resolved
Hide resolved
Deploy preview for dagit-core-storybook ready! ✅ Preview Built with commit dd973ae. |
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.
almost there
js_modules/dagster-ui/packages/ui-core/src/metadata/MetadataEntry.tsx
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Outdated
Show resolved
Hide resolved
...on_modules/libraries/dagster-embedded-elt/dagster_embedded_elt_tests/test_asset_decorator.py
Outdated
Show resolved
Hide resolved
Great feedback, per usual @rexledesma - updated the PR. (767459c) |
28e303f
to
767459c
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.
a bit more on the testing side
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Outdated
Show resolved
Hide resolved
...on_modules/libraries/dagster-embedded-elt/dagster_embedded_elt_tests/test_asset_decorator.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt_tests/test_op.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/asset_decorator.py
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/asset_decorator.py
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/asset_decorator.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt_tests/test_op.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.
See comments before merging
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt/sling/resources.py
Show resolved
Hide resolved
python_modules/libraries/dagster-embedded-elt/dagster_embedded_elt_tests/test_op.py
Outdated
Show resolved
Hide resolved
…decorator using metadata (#20564) ## Summary & Motivation The current implementation of the Sling integration requires passing the _DagsterSlingTranslator_ and replication config to both the `@sling_assets` decorator, and the `replicate` method in the function body. Following the approach of `dagster-dbt` and the soon-to-be _dlt_ integration. this pull request demonstrates how we can pass the translator to the `replicate` method through the use of metadata. This workaround leads to a more intuitive end-user experience, albeit with more complex implementation. The negative to this approach is that the _translator_ and _replication-config_ remain on the metadata, see the modified unit test. ## How I Tested These Changes Ran unit tests.
Summary & Motivation
The current implementation of the Sling integration requires passing the DagsterSlingTranslator and replication config to both the
@sling_assets
decorator, and thereplicate
method in the function body.Following the approach of
dagster-dbt
and the soon-to-be dlt integration. this pull request demonstrates how we can pass the translator to thereplicate
method through the use of metadata. This workaround leads to a more intuitive end-user experience, albeit with more complex implementation.The negative to this approach is that the translator and replication-config remain on the metadata, see the modified unit test.
How I Tested These Changes
Ran unit tests.