Hi, thanks for the amazing software! Is there a s...
# ask-community
a
Hi, thanks for the amazing software! Is there a straightforward way to list partitions of an asset that are missing? (Ie. haven’t been materialized or don’t have runs that have failed?) I could probably get list of all partition keys, then go through event logs and see which keys don’t have events associated with them. But ideally I wouldn’t want to implement this myself :)
c
Hi Aleksi. I think the most straightforward way is still to fetch the events, though I can provide an (untested) code snippet if it helps:
Copy code
partitions_to_fetch = partitions_def.get_partition_keys(...)
        
partition_materializations = context.instance.get_event_records(
    EventRecordsFilter(
        event_type=DagsterEventType.ASSET_MATERIALIZATION,
        asset_key=asset_key,
        asset_partitions=partitions_to_fetch,
    ),
)

materialized_keys = set(materialization.partition_key for materialization in partition_materializations)
unmaterialized_keys = set(partitions_to_fetch) - set(materialized_keys)