https://dagster.io/ logo
Title
s

sourabh upadhye

10/01/2021, 6:36 AM
Also can we access AssetMaterialization metadata by any means?
j

Josh Lloyd

10/01/2021, 4:36 PM
Here is some code I’ve used to access Asset materialization metada:
@sensor(pipeline_name="pipeline", mode=ENV)
def sensor(context):
    """ Workaround for wildcard matching on asset_keys. From <https://github.com/dagster-io/dagster/issues/4582> """
    after_cursor = int(context.cursor) if context.cursor else None
    event_records = context.instance.get_event_records(
        EventRecordsFilter(
            event_type=DagsterEventType.ASSET_MATERIALIZATION,
            after_cursor=after_cursor,
        ),
        ascending=True,
    )

    for event_record in event_records:
        materialization = event_record.event_log_entry.dagster_event.event_specific_data.materialization
        asset_key = json.loads(materialization.asset_key.to_string())

...
s

sourabh upadhye

10/01/2021, 5:26 PM
Cool👍