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

Jacob Marcil

03/23/2023, 9:30 PM
When using MultiPartitionDefinition with a date and a static field. If we try to access the partition of the run with
asset_partition_key_range
we end up with
PartitionKeyRange(start='2020-12-18|Something_Static', end='2023-03-22|Something_else_static')
Since it’s a list of static elements, there’s no way to all the
static
elements of that run right? Precision I’m trying to run multiple partitions in a
Single Run
c

claire

03/23/2023, 11:12 PM
Hi Jacob. You can do something like this:
Copy code
key.keys_by_dimension[static_dimension_name] for key in context.asset_partition_keys_for_output
to get just the static partition keys
thank you box 1
j

Jacob Marcil

03/24/2023, 1:49 PM
Thank you very much this helps a lot. Another thing links to that. I couldn’t find documentation on how to structure the return object when starting a job in a
Single Run
with multiple partitions. Do you have any docs you can send me or a draft version of code. Like do I need to use the
Ouput
object and specify which dict is linked to which partition?
c

claire

03/24/2023, 4:09 PM
So if you just yield outputs as normal, i.e.
Copy code
@asset(partitions_def=...)
def my_asset():
    return 1
and you select a range of partitions to execute on, dagster will automatically yield a materialization per partition for the same output
8 Views