{"record":{"id":"78399380514bb131","repo":"dbt-labs/dbt-core","slug":"adapter-parse-partition-by-failed-on-raw-partitio","errorCode":null,"errorMessage":"adapter.parse_partition_by failed on {raw_partition_by:?}: {e}","messagePattern":"adapter\\.parse_partition_by failed on (.+?): (.+?)","errorType":"exception","errorClass":"minijinja::Error::SerdeDeserializeError","httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/adapter_impl.rs","lineNumber":3865,"sourceCode":"                    let new_map: IndexMap<String, Value> = partition_by_map\n                        .into_iter()\n                        .map(|(key, value)| {\n                            let normalized_value = if let Some(s) = value.as_str() {\n                                Value::from(s.to_lowercase())\n                            } else {\n                                value\n                            };\n                            (key, normalized_value)\n                        })\n                        .collect();\n                    Value::from_serialize(&new_map)\n                } else {\n                    raw_partition_by.clone()\n                };\n\n                let partition_by = minijinja_value_to_typed_struct::<PartitionConfig>(normalized)\n                    .map_err(|e| {\n                    minijinja::Error::new(\n                        minijinja::ErrorKind::SerdeDeserializeError,\n                        format!(\"adapter.parse_partition_by failed on {raw_partition_by:?}: {e}\"),\n                    )\n                })?;\n\n                let validated_config = partition_by.into_bigquery().ok_or_else(|| {\n                    minijinja::Error::new(\n                        minijinja::ErrorKind::InvalidArgument,\n                        \"Expect a BigqueryPartitionConfigStruct\",\n                    )\n                })?;\n\n                Ok(Value::from_object(validated_config))\n            }\n            Postgres | Snowflake | Databricks | Redshift | Salesforce | Spark | DuckDB\n            | LakeCompute | Fabric | ClickHouse | Exasol | Starburst | Athena | Trino\n            | Datafusion | Dremio | Oracle => {\n                unimplemented!(\"only available with BigQuery adapter\")","sourceCodeStart":3847,"sourceCodeEnd":3883,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/adapter_impl.rs#L3847-L3883","documentation":"parse_partition_by normalizes and deserializes a raw partition_by config value into PartitionConfig via serde. If the value (string like \"DATE(x)\", dict, or other shape) cannot be parsed into PartitionConfig, it is rethrown as a SerdeDeserializeError including the raw input and underlying message. It exists to validate BigQuery partition configs before use.","triggerScenarios":"Config {\"partition_by\": ...} with a malformed value: invalid dict keys, bad structure (e.g. missing 'field'), or a string that normalization cannot turn into a valid PartitionConfig.","commonSituations":"Typo in partition_by config keys (e.g. 'columns' instead of 'field'); granularity/range misspelled or wrong-typed; passing a non-string non-dict value; BigQuery-specific configs used without the required structure.","solutions":["Check the error message's raw_partition_by dump and the serde message; fix the offending key/type in your model config.","Use documented shapes: {\"field\": \"...\", \"data_type\": ..., \"granularity\": ...} or a range/time configuration.","If using a range partition, ensure 'range' contains start/end/interval integers.","Test the config with a minimal model before re-running the full pipeline."],"exampleFix":"// before (invalid key)\n{{ config(partition_by={\"column\": \"event_date\", \"granularity\": \"day\"}) }}\n\n// after\n{{ config(partition_by={\"field\": \"event_date\", \"data_type\": \"date\", \"granularity\": \"day\"}) }}","handlingStrategy":"validation","validationCode":"def valid_partition_by(p):\n    if isinstance(p, str):\n        return True  # expression form, e.g. DATE(col) or range config string\n    if isinstance(p, dict):\n        return 'field' in p and isinstance(p['field'], str)\n    return False\nif not valid_partition_by(config.get('partition_by')):\n    raise ValueError('partition_by must be a string or a dict with a string field key')","typeGuard":"def as_partition_config(p):\n    if isinstance(p, str):\n        return {'raw': p}\n    if isinstance(p, dict) and 'field' in p:\n        return p\n    return None","tryCatchPattern":"try:\n    parsed = adapter.parse_partition_by(raw_partition_by)\nexcept Exception as e:\n    raise ValueError(f'partition_by config invalid: {raw_partition_by!r}: {e}') from e","preventionTips":["Use the documented keys: field, data_type, granularity, range","Never rename 'field' to 'column' or 'columns'","Keep range values as integers (start, end, interval)","Run a single-model dbt parse/compile to catch config typos early"],"tags":["config","partitioning","bigquery","serde"],"backgroundTag":"invalid-config-value","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}