Hi everyone, I'm trying to understand how DynamicP...
# ask-community
f
Hi everyone, I'm trying to understand how DynamicPartitionsDefinition work and I'm having a hard time in figuring out how we can attach this to a running project. I understand that sensors can add partitions dynamically, but what if we had partitions before and want to represent and visualize them in Dagit? I'm looking for a way to set the initial state of the DynamicPartitionsDefinition basically 🤔
maybe this could be added to the documentation? Or is this a hack and not a standard behavior?
c
Are you talking about switching from a different partitions definition to dynamic partitions definition on a running project? I’m actually not sure what happens to the history here, opening a discussion.
The method sandy describes int he above thread is canonical and is already in the docs (admittedly our docs search is really bad and its something we’re working on improving)
f
thanks! I can't find that exact function in this document though... the one from dagster instance
c
Ah i see - I think we’ve changed our recommendation here to use the
dynamic_partition_requests
for sensors… cc @claire on the historical context there (I think we’re thinking about changing the access on instance method
c
Hi Fabio! Yep, we're currently considering an improved API for adding/deleting partitions from within assets and ops, which is why the
context.instance.add_dynamic_partitions(...)
methods have been removed from our docs. For now, if you want to have this functionality from within assets, you can continue to use the instance method. Within sensors, I'd recommend the
dynamic_partitions_requests
API.
f
All right! This was mostly an exploratory effort so the singleton helped me get it up and running quickly. But the final solution will indeed use a sensor from our API