Skip to content

Commit

Permalink
Update the erroneous usage of DagsterDltResource (#26345)
Browse files Browse the repository at this point in the history
## Summary & Motivation

Ran into issues/found a mismatch when copying code from DOP.

## How I Tested These Changes

Ran on my personal project.
  • Loading branch information
deepyaman authored Dec 10, 2024
1 parent 2c9eb54 commit 09c3ac3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/content/integrations/embedded-elt/dlt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ from dagster_embedded_elt.dlt import (
DagsterDltTranslator,
dlt_assets,
)
from dlt.extract.resource import DltResource
from dagster import AssetExecutionContext, AssetKey
Expand All @@ -257,11 +258,11 @@ def example_dlt_source():
class CustomDagsterDltTranslator(DagsterDltTranslator):
def get_asset_key(self, resource: DagsterDltResource) -> AssetKey:
def get_asset_key(self, resource: DltResource) -> AssetKey:
"""Overrides asset key to be the dlt resource name."""
return AssetKey(f"{resource.name}")
def get_deps_asset_keys(self, resource: DagsterDltResource) -> Iterable[AssetKey]:
def get_deps_asset_keys(self, resource: DltResource) -> Iterable[AssetKey]:
"""Overrides upstream asset key to be a single source asset."""
return [AssetKey("common_upstream_dlt_dependency")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
DagsterDltTranslator,
dlt_assets,
)
from dlt.extract.resource import DltResource

from dagster import AssetExecutionContext, AssetKey

Expand All @@ -18,11 +19,11 @@ def example_resource(): ...


class CustomDagsterDltTranslator(DagsterDltTranslator):
def get_asset_key(self, resource: DagsterDltResource) -> AssetKey:
def get_asset_key(self, resource: DltResource) -> AssetKey:
"""Overrides asset key to be the dlt resource name."""
return AssetKey(f"{resource.name}")

def get_deps_asset_keys(self, resource: DagsterDltResource) -> Iterable[AssetKey]:
def get_deps_asset_keys(self, resource: DltResource) -> Iterable[AssetKey]:
"""Overrides upstream asset key to be a single source asset."""
return [AssetKey("common_upstream_dlt_dependency")]

Expand Down

1 comment on commit 09c3ac3

@github-actions
Copy link

Choose a reason for hiding this comment

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

Deploy preview for dagster-docs ready!

✅ Preview
https://dagster-docs-7z8ihgnok-elementl.vercel.app
https://master.dagster.dagster-docs.io

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

Please sign in to comment.