Hi! I have a question during using of `asset_senso...
# ask-community
r
Hi! I have a question during using of `asset_sensor()`: Is it possible to get metadata values I stored with
AssetMaterialization
event? For instance, I have `AssetMaterialization`:
Copy code
AssetMaterialization(
    asset_key=AssetKey("my_key"),
    description="Update asset",
    metadata={
        "date": "2022-12-01"
    },
)
Then I would like to get these value in
asset_sensor
method:
Copy code
@asset_sensor(asset_key=AssetKey("my_key"), job=dbx_to_druid_general_job)
def internal_bi_bid_funnel_etl_job_sensor(context: SensorEvaluationContext, asset_event: EventLogEntry):
    ...
🤖 1
d
I have used the graphql API for this kind of thing (though not in a sensor), and was very pleasantly surprised by how easy it was.
pipelineRunsOrError(filter: $runsFilter, limit: $limit) {
... on PipelineRuns {
results {
assertMaterializations {
<get data here>
}
}
}
}
Should be pretty close
Hopefully there is an easier way in an
asset_sensor
b
Roman, I think you should be able to access the entire
AssetMaterialization
including the metadata through the
asset_event
parameter. Specifically:
asset_event.dagster_event.event_specific_data.materialization
dagster bot responded by community 2