When using `partition_mappings` for an asset, is t...
# ask-community
d
When using
partition_mappings
for an asset, is there any way to get the exact set of the mapped partitions of the upstream asset? I understand how to access the partitions range with
range_start, range_end = context.asset_partition_key_range
, but I would like to have the exact set, because it may differ for different partitioning schemas (daily, monthly, etc). Seems like
dagster.core.definitions.time_window_partitions.TimeWindowPartitionsDefinition.get_partitions
would help, but I don't know how to access it from the IO Manager context. Any help?
s
Hey Daniel - we don't currently provide a function that gives the exact set within a range, however, you can get the partitions definition from
context.asset_output_info.partitions_def
on an
OutputContext
. I'd recommend using
get_partition_keys
instead of
get_partitions
, because the latter returns
Partition
objects instead of strings, which might not be supported in the future
❤️ 1
d
Thanks! In Dagster 0.15.4 I found this attribute (for InputContext):
context.upstream_output.asset_info.partitions_def
I assume this is the one I need? There is no
asset_output_info
attribute.
Unfortunately, the value of this attribute is None even tho I'm using a partitioned asset...
hey @sandy, any advice here?