-
How can I check whether a specific partition of an asset is materialized? Sourced from this question on Slack: https://dagster.slack.com/archives/C01U954MEER/p1693234533285929 |
Beta Was this translation helpful? Give feedback.
Answered by
sryza
Aug 28, 2023
Replies: 1 comment
-
This should work: from dagster import DagsterInstance, EventRecordsFilter, DagsterEventType, AssetKey
def _is_partition_materialized(
asset_key: AssetKey, partition_key: str, instance: DagsterInstance
) -> bool:
return bool(
instance.get_event_records(
EventRecordsFilter(
asset_key=asset_key,
event_type=DagsterEventType.ASSET_MATERIALIZATION,
asset_partitions=[partition_key],
),
limit=1,
)
) You can get the instance using |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sryza
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should work:
You can get the instance using
context.instance
inside any Dagster function that accepts a context object.