when using context.asset_partition_key_range_for_o...
# ask-community
c
when using context.asset_partition_key_range_for_output() inside an asset, is there a way I can get the individual dates inside that range, so that the metadata for each materialization is unique to that date and not to the entire range I'm backfilling on?
s
You can use
context.asset_partition_keys_for_output
- would that work for you?
c
Sorry, I meant moreso getting the individual partition key for each materialization, so I can filter the metadata for that partition. Not sure if this is possible currently.
s
to help me understand what you're trying to accomplish, are you able to provide a code example that you'd ideally like to work?
c
Essentially I want the metadata to be unique to each materialization, even when doing a ranged backfill, which seems to be an open issue: https://github.com/dagster-io/dagster/issues/12498 I was hoping there was some way of accessing the current materialization from context.instance, which could be used as a workaround for the above issue, so I could have df.loc[date==<materialization partition key>].head() instead of just df.head() inside my metadata.
s
I was hoping there was some way of accessing the current materialization from context.instance
the materialization is created after the op completes, so it can't be accessed from the op because it doesn't exist yet, if I'm understanding what you're referring to correctly
c
ah got it, thanks for clarifying