Skip to content

Commit

Permalink
external asset toy
Browse files Browse the repository at this point in the history
  • Loading branch information
schrockn committed Oct 9, 2023
1 parent 856caf8 commit bcdf1b2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions python_modules/dagster-test/dagster_test/toys/extenral_assets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from dagster import AssetMaterialization, AssetSpec, Definitions, OpExecutionContext, job, op
from dagster._core.definitions.external_asset import external_assets_from_specs

asset_one = AssetSpec("asset_one")

asset_two = AssetSpec("asset_two", deps=[asset_one])


@op
def insert_materializations(context: OpExecutionContext) -> None:
context.log_event(
AssetMaterialization(asset_one.key, metadata={"nrows": 10, "source": "From this script."})
)
context.log_event(
AssetMaterialization(asset_two.key, metadata={"nrows": 12, "source": "From this script."})
)


@job
def insert_materializations_job() -> None:
insert_materializations()


defs = Definitions(
assets=external_assets_from_specs([asset_one, asset_two]), jobs=[insert_materializations_job]
)

0 comments on commit bcdf1b2

Please sign in to comment.