Why the function add_dynamic_partitions can't hand...
# ask-community
n
Why the function add_dynamic_partitions can't handle a Partition object list? Dynamic partitions can handle every kind of partition using deprected param partition_fn, but only static string partitions using the experimental name param.
Copy code
def get_partitions():
    ps = blah blah
    return [Partition(name=p.n, value=p.v) for p in ps]

partition_def = DynamicPartitionsDefinition(get_partitions) # OK
Copy code
def get_partitions():
    ps = blah blah
    return [Partition(name=p.n, value=p.v) for p in ps]

partition_def = DynamicPartitionsDefinition(name="name")
context.instance.add_dynamic_partitions(partition_def.name, get_partitions()) # NOT OK
1
c
Hi Cedric. We're moving away from supporting the
Partition
object and instead just use string partition keys. For that reason the new dynamic partitions only accept string values
🙏 1
n
Ok thanks ! Why remove Partition object ? In my case, I want to build a run_config with more complex information than just the key, there is something for this use case ? I will add a cutom local key-value storage and map my partitions key to the config, but it looks like a hack.
c
I believe we removed it because we weren't actually using fields on
Partition
object anywhere in the system, only using the partition key. So development was sometimes cumbersome having to build/fetch this
Partition
object throughout the system. Have you seen our docs on partitioned config? https://docs.dagster.io/concepts/partitions-schedules-sensors/partitions#date-partitioned-job If you want to pass in additional fields to run config other than just the partition key, I would recommend using partitioned config.