Hi! I try to retrieve the partition keys for dynam...
# ask-community
j
Hi! I try to retrieve the partition keys for dynamic partitioning (in local), I get the following error:
Copy code
dagster._check.CheckError: Failure condition: The instance is not available to load partitions. You may be seeing this error when using dynamic partitions with a version of dagit or dagster-cloud that is older than 1.1.18.
I don't quite understand the origin of this error since I am using version 1.3.1. I ran the
dagster instance migrate
command. Am I missing something?
Copy code
fruits = DynamicPartitionsDefinition(name="fruits")

my_job = define_asset_job(
    "my_job", selection=AssetSelection.all(), partitions_def=fruits
)

@sensor(job=my_job)
def my_sensor():
    partitions = fruits.get_partitions()
c
checking with the team on this one
c
Hi Jordan. Dagster stores the partition keys for a dynamic partitions def in the instance, so you need to pass the instance into your call:
Copy code
fruits = DynamicPartitionsDefinition(name="fruits")

my_job = define_asset_job(
    "my_job", selection=AssetSelection.all(), partitions_def=fruits
)

@sensor(job=my_job)
def my_sensor(context):
    partitions = fruits.get_partition_keys(dynamic_partitions_store=context.instance)
🌈 1
j
Oh yeah right, thanks Claire. I hadn't understood that subtlety.