Hi! I'm using a sensor that triggers a partitioned...
# ask-community
j
Hi! I'm using a sensor that triggers a partitioned asset job as soon as a file is detected in an S3 bucket, I'd like to retrieve metadata in the assets that originally came from the sensor. Is there a way to achieve this?
b
If you’re trying to access that metada inside the job triggered by the sensor, you can pass it ti the job through the
run_config
argument of the
RunRequest
c
You could also directly query the event records from within an op in your job if you don't want to pass it through run config:
Copy code
records = context.instance.get_event_records(EventRecordsFilter(event_type=DagsterEventType.ASSET_MATERIALIZATION, asset_key=AssetKey("foo")))
for record in records:
    metadata_entries = record.event_log_entry.materialization.metadata_entries