it is possible to add a partition in a DynamicPart...
# ask-ai
g
it is possible to add a partition in a DynamicPartitionsDefintion object outside of a sensor, without using RunRequest of SensorResult??
s
Yes, it is possible to add a partition to a
DynamicPartitionsDefinition
outside of a sensor without using
RunRequest
or
SensorResult
. The documentation provides an example where a user mentions using
DagsterInstance.get().add_dynamic_partition
to add partition keys programmatically without materialization through a sensor. This method allows you to update partition keys automatically, and you can choose to materialize them manually later if desired. Here is a snippet from the discussion that illustrates this approach:
Copy code
python # Assuming you have a DynamicPartitionsDefinition named 'my_dynamic_partitions_def' from dagster import DagsterInstance  # You can add a partition key like this DagsterInstance.get().add_dynamic_partition(     partition_set_name='my_dynamic_partitions_def',     partition_key='new_partition_key' )
This code is not directly from the documentation but is based on a user's contribution in a discussion. It demonstrates how to add a dynamic partition programmatically without the need for a sensor or run request. However, please note that this approach was mentioned in a discussion and may not be officially documented or supported as a standard practice. Always refer to the latest official Dagster documentation for the most accurate and supported methods.