Hi, I create the asset using `load_assets_from_dbt...
# ask-community
j
Hi, I create the asset using
load_assets_from_dbt_project:
Copy code
dbt_assets = with_resources(
    load_assets_from_dbt_project(
        project_dir=DBT_PROJECT_PATH,
        profiles_dir=DBT_PROFILES,
        partitions_def=fivetran_prod_test_connection_test_03,
        key_prefix=["dbt_vault"],
    ),
    {
        "dbt": dbt_cli_resource.configured(
            {
                "project_dir": DBT_PROJECT_PATH,
                "profiles_dir": DBT_PROFILES,
            },
        )
    },
)
And then create the dynamic partition:
Copy code
fivetran_prod_test_connection_test_03 = DynamicPartitionsDefinition(
    name="fivetran_prod_test_connection_test_03",
)
instance = DagsterInstance.get()
instance.add_dynamic_partitions("fivetran_prod_test_connection_test_03", ["init_load"])
1. I'm using
instance.add_dynamic_partitions("partition_def_name", ["INITIAL_LOAD"])
to create the initial_load partition. but when I try to materialize that partition, got this error:
Copy code
dagster._core.errors.PartitionExecutionError: Error occurred during the evaluation of the `tags_for_partition` function for partitioned config on job '__ASSET_JOB_0'

  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_grpc\impl.py", line 478, in get_partition_tags
    return ExternalPartitionTagsData(name=partition.name, tags=tags)
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\errors.py", line 211, in user_code_error_boundary
    raise error_cls(

The above exception was caused by the following exception:
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.

  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\errors.py", line 204, in user_code_error_boundary
    yield
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_grpc\impl.py", line 475, in get_partition_tags
    tags = partitioned_config.get_tags_for_partition_key(
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\definitions\partition.py", line 755, in get_tags_for_partition_key
    partition = self._key_to_partition(partition_key, current_time, instance)
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\definitions\partition.py", line 781, in _key_to_partition
    for p in self.partitions_def.get_partitions(
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\definitions\partition.py", line 674, in get_partitions
    check.failed(
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_check\__init__.py", line 1669, in failed
    raise CheckError(f"Failure condition: {desc}")
2. Then why I try to materialize using shift+click to add configuration for the dbt-asset. At first, the dbt run well, but in the end. I got this error:
Copy code
dagster._core.errors.DagsterInvariantViolationError: Cannot access partition_key for a non-partitioned run

  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\execution\plan\execute_plan.py", line 268, in dagster_event_sequence_for_step
    for step_event in check.generator(step_events):
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\execution\plan\execute_step.py", line 381, in core_dagster_event_sequence_for_step
    for evt in _type_check_and_store_output(step_context, user_event):
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\execution\plan\execute_step.py", line 434, in _type_check_and_store_output
    for evt in _store_output(step_context, step_output_handle, output):
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\execution\plan\execute_step.py", line 665, in _store_output
    asset_key, partitions = _asset_key_and_partitions_for_output(output_context)
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\execution\plan\execute_step.py", line 448, in _asset_key_and_partitions_for_output
    output_asset_info.partitions_fn(output_context) or set(),
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\definitions\asset_layer.py", line 530, in partitions_fn
    context.asset_partition_key_range,
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\execution\context\output.py", line 437, in asset_partition_key_range
    return self.step_context.asset_partition_key_range_for_output(self.name)
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\execution\context\system.py", line 1011, in asset_partition_key_range_for_output
    return self.asset_partition_key_range
  File "C:\Users\nkduy3\AppData\Local\Programs\Python\Python39\lib\site-packages\dagster\_core\execution\context\system.py", line 407, in asset_partition_key_range
    raise DagsterInvariantViolationError(
d
Hi Julius, sorry for the trouble here - the first issue is a bug that was introduced in the 1.2.4 release last week and is being fixed in the 1.2.5 release tomorrow. In the meantime I would expect downgrading 1.2.3 to fix it.