Skip to content
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

Merged
merged 13 commits into from
Mar 22, 2024

Conversation

cmpadden
Copy link
Contributor

@cmpadden cmpadden commented Mar 19, 2024

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.

@cmpadden cmpadden requested a review from PedramNavid March 19, 2024 18:43
@cmpadden cmpadden force-pushed the colton/sling-example-metadata-passing branch from 48b4026 to df8a236 Compare March 21, 2024 14:49
Comment on lines 13 to 20
@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,
Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@cmpadden cmpadden changed the title [embedded-elt][sling] example of passing translator from decorator using metadata [embedded-elt][sling] passing translator and replication config from decorator using metadata Mar 21, 2024
Copy link

github-actions bot commented Mar 21, 2024

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-a9ar5rhy2-elementl.vercel.app
https://colton-sling-example-metadata-passing.core-storybook.dagster-docs.io

Built with commit dd973ae.
This pull request is being automatically deployed with vercel-action

@cmpadden cmpadden requested a review from rexledesma March 21, 2024 19:14
Copy link
Contributor

@rexledesma rexledesma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost there

@cmpadden
Copy link
Contributor Author

cmpadden commented Mar 21, 2024

Great feedback, per usual @rexledesma - updated the PR. (767459c)

@cmpadden cmpadden requested a review from rexledesma March 21, 2024 20:47
@cmpadden cmpadden force-pushed the colton/sling-example-metadata-passing branch from 28e303f to 767459c Compare March 21, 2024 20:49
Copy link
Contributor

@rexledesma rexledesma left a 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

@cmpadden cmpadden requested a review from rexledesma March 22, 2024 17:52
Copy link
Contributor

@rexledesma rexledesma left a 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

@cmpadden cmpadden merged commit 81f9699 into master Mar 22, 2024
3 checks passed
@cmpadden cmpadden deleted the colton/sling-example-metadata-passing branch March 22, 2024 19:02
PedramNavid pushed a commit that referenced this pull request Mar 28, 2024
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants