https://dagster.io/ logo
#ask-community
Title
# ask-community
c

Caelan Schneider

08/29/2023, 2:22 PM
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

sandy

08/29/2023, 6:08 PM
You can use
context.asset_partition_keys_for_output
- would that work for you?
c

Caelan Schneider

08/29/2023, 8:27 PM
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

sandy

08/29/2023, 8:55 PM
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

Caelan Schneider

08/30/2023, 12:59 PM
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

sandy

08/31/2023, 2:21 AM
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

Caelan Schneider

08/31/2023, 7:29 PM
ah got it, thanks for clarifying
11 Views