How can we mark partitions as "materialized" in dagster if the data already exists in the DWH? #17847
-
Is there a way to tell Dagster that the first thousand partitions of a time-partitioned asset are already completed ? If I copy data manually into a table? I'd like to mark these assets and partitions as materialized without actually running the code that overwrites their contents. Context:
Problem Statement:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
You can report assets and asset partitions as materialized in Dagster without actually running the computation that materializes. This is possible from the UI and using Dagster's Python APIs. From the UIIf you go to the page for the asset, you can click the dropdown next to the "Materialize" button and click "Report materialization events". Then you'll get a dialog that allows you to choose a partition range: Using the Python APIsFirst, get your hands on a Then you can use from dagster import AssetMaterialization, AssetKey
for partition_key in partition_keys:
asset_materialization = AssetMaterialization(AssetKey("my_asset_key"), partition=partition_key)
instance.report_runless_asset_event(asset_materialization) |
Beta Was this translation helpful? Give feedback.
-
thanks a lot for the detailed response @sryza |
Beta Was this translation helpful? Give feedback.
-
Is there a way to do the opposite? That is, report that a previously materialized partition is now failed or missing? Both via the UI and the Python API? |
Beta Was this translation helpful? Give feedback.
You can report assets and asset partitions as materialized in Dagster without actually running the computation that materializes. This is possible from the UI and using Dagster's Python APIs.
From the UI
If you go to the page for the asset, you can click the dropdown next to the "Materialize" button and click "Report materialization events".
Then you'll get a dialog that allows you to choose a partition range:
Using the Python APIs
First, get your hands on a
DagsterInstance
: #7427.Then you can use
DagsterInstance.report_runless_asset_event
: