Skip to content

Commit

Permalink
No default mutable object in dlt_dagster_translator argument to dlt_a…
Browse files Browse the repository at this point in the history
…ssets (#21350)

## Summary & Motivation

Similar to #21340, but for `dlt_assets`. Per https://docs.python-guide.org/writing/gotchas/ you should not set a default parameter to an object instance.

## How I Tested These Changes

BK
  • Loading branch information
schrockn authored Apr 23, 2024
1 parent 7b34aba commit a92dc1b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from dagster import (
AssetsDefinition,
AssetSpec,
_check as check,
multi_asset,
)
from dlt.extract.source import DltSource
Expand All @@ -18,7 +19,7 @@ def dlt_assets(
dlt_pipeline: Pipeline,
name: Optional[str] = None,
group_name: Optional[str] = None,
dlt_dagster_translator: DagsterDltTranslator = DagsterDltTranslator(),
dlt_dagster_translator: Optional[DagsterDltTranslator] = None,
) -> Callable[[Callable[..., Any]], AssetsDefinition]:
"""Asset Factory for using data load tool (dlt).
Expand Down Expand Up @@ -76,6 +77,10 @@ def github_reactions_dagster_assets(context: AssetExecutionContext, dlt: DltDags
yield from dlt.run(context=context)
"""
dlt_dagster_translator = (
check.opt_inst_param(dlt_dagster_translator, "dlt_dagster_translator", DagsterDltTranslator)
or DagsterDltTranslator()
)
return multi_asset(
name=name,
group_name=group_name,
Expand Down

0 comments on commit a92dc1b

Please sign in to comment.