dbt-labs/dbt-core · error · minijinja::Error::InvalidArgument

Expect a BigqueryPartitionConfigStruct

Error message

Expect a BigqueryPartitionConfigStruct

What it means

After successfully deserializing a PartitionConfig, parse_partition_by converts it into a BigQuery-specific partition config via into_bigquery(). If that conversion returns None, an InvalidArgument error 'Expect a BigqueryPartitionConfigStruct' is thrown. This means the parsed config is not representable as a BigQuery partition config, an internal invariant/unexpected config shape.

Source

Thrown at crates/dbt-adapter/src/adapter/adapter_impl.rs:3872

                            };
                            (key, normalized_value)
                        })
                        .collect();
                    Value::from_serialize(&new_map)
                } else {
                    raw_partition_by.clone()
                };

                let partition_by = minijinja_value_to_typed_struct::<PartitionConfig>(normalized)
                    .map_err(|e| {
                    minijinja::Error::new(
                        minijinja::ErrorKind::SerdeDeserializeError,
                        format!("adapter.parse_partition_by failed on {raw_partition_by:?}: {e}"),
                    )
                })?;

                let validated_config = partition_by.into_bigquery().ok_or_else(|| {
                    minijinja::Error::new(
                        minijinja::ErrorKind::InvalidArgument,
                        "Expect a BigqueryPartitionConfigStruct",
                    )
                })?;

                Ok(Value::from_object(validated_config))
            }
            Postgres | Snowflake | Databricks | Redshift | Salesforce | Spark | DuckDB
            | LakeCompute | Fabric | ClickHouse | Exasol | Starburst | Athena | Trino
            | Datafusion | Dremio | Oracle => {
                unimplemented!("only available with BigQuery adapter")
            }
        }
    }

    /// BigQueryAdapter https://github.com/dbt-labs/dbt-adapters/blob/0efd8d3d1081e1ab43e38797d5104f7b424a6284/dbt-bigquery/src/dbt/adapters/bigquery/impl.py#L1139
    pub fn get_table_options(
        &self,

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Simplify or restructure the partition_by config to a documented BigQuery form (time or range partitioning).
  2. Verify you are targeting the BigQuery adapter; other adapters should use their own partition handling.
  3. Upgrade the adapter crate — into_bigquery may not support newer config variants in your version.
  4. If it looks like a valid BigQuery config, file a bug with the raw config; this may be an internal conversion gap.

Example fix

// before (non-BigQuery style)
{{ config(partition_by={"columns": ["a", "b"]}) }}

// after
{{ config(partition_by={"field": "created_at", "data_type": "timestamp", "granularity": "day"}) }}
Defensive patterns

Strategy: try-catch

Validate before calling

def is_bigquery_partition_shape(p):
    if isinstance(p, str):
        return True
    if isinstance(p, dict):
        has_time = 'field' in p
        has_range = 'range' in p and {'start', 'end'} <= set(p['range'])
        return has_time or has_range
    return False

Type guard

def narrow_bigquery_partition(parsed):
    return parsed if parsed is not None else None  # into_bigquery returned None => not BigQuery-shape

Try / catch

try:
    partition_cfg = adapter.parse_partition_by(raw)
except Exception as e:
    if 'BigqueryPartitionConfigStruct' in str(e):
        raise ValueError(f'{raw!r} is not a BigQuery-supported partition config') from e
    raise

Prevention

When it happens

Trigger: A PartitionConfig that deserializes but whose variant does not convert to a BigqueryPartitionConfigStruct in into_bigquery(), e.g. a config shape only valid for another adapter.

Common situations: Using partition configs designed for another warehouse with the BigQuery adapter; an adapter/version mismatch where a new partition type isn't supported by into_bigquery yet.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/dd9fef263b2fab17. Report an issue: GitHub.