{"record":{"id":"eca370d0848429b4","repo":"dbt-labs/dbt-core","slug":"strategy-strategy-requires-non-empty-partitio","errorCode":null,"errorMessage":"'{strategy}' strategy requires non-empty 'partition_by'. Current partition_by is None.","messagePattern":"'(.+?)' strategy requires non-empty 'partition_by'\\. Current partition_by is None\\.","errorType":"validation","errorClass":"AdapterError","httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/metadata/clickhouse/mod.rs","lineNumber":922,"sourceCode":"    if matches!(strategy, \"delete_insert\" | \"microbatch\") && !has_lw_deletes {\n        return err(format!(\n            \"'{strategy}' strategy requires lightweight deletes, but the required setting \\\n             '{ND_MUTATION_SETTING}' could not be enabled on this ClickHouse server \\\n             (see the warnings logged at connection time).\"\n        ));\n    }\n    if matches!(strategy, \"delete_insert\" | \"microbatch\") && !has_unique_key {\n        return err(format!(\n            \"'{strategy}' strategy requires a non-empty 'unique_key'.\"\n        ));\n    }\n    if !matches!(strategy, \"delete_insert\" | \"microbatch\") && has_predicates {\n        return err(format!(\n            \"Cannot apply incremental predicates with '{strategy}' strategy.\"\n        ));\n    }\n    if strategy == \"insert_overwrite\" && !has_partition_by {\n        return err(format!(\n            \"'{strategy}' strategy requires non-empty 'partition_by'. Current partition_by is None.\"\n        ));\n    }\n    if strategy == \"insert_overwrite\" && has_unique_key {\n        return err(format!(\n            \"'{strategy}' strategy does not support unique_key.\"\n        ));\n    }\n    Ok(())\n}\n\n/// Mirrors column.py `ClickHouseColumnChanges` as a Jinja value: none when\n/// there are no changes (its `__bool__`, so `{% if column_changes %}` skips),\n/// else a map; errors when the strategy cannot reconcile the changes.\npub(crate) fn column_changes_value(\n    on_schema_change: &str,\n    source: Vec<Column>,\n    target: Vec<Column>,","sourceCodeStart":904,"sourceCodeEnd":940,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/metadata/clickhouse/mod.rs#L904-L940","documentation":"The insert_overwrite incremental strategy on ClickHouse works by replacing whole partitions, so a non-empty partition_by config is mandatory. validate_incremental_strategy raises this Configuration error when insert_overwrite is selected but partition_by is None.","triggerScenarios":"Setting incremental_strategy='insert_overwrite' on a ClickHouse incremental model without a partition_by column/expression, or with an empty partition_by value.","commonSituations":"Switching a model from append to insert_overwrite without adding partitioning; copying the strategy from an example that assumed a partitioned table.","solutions":["Add a non-empty partition_by config (e.g. a date column) to the model","Ensure the partition_by expression is valid for ClickHouse (no mutable functions like now())","If the table cannot be partitioned, use 'append' or 'delete_insert' instead"],"exampleFix":"// before\n{{ config(materialized='incremental', incremental_strategy='insert_overwrite') }}\n// after\n{{ config(materialized='incremental', incremental_strategy='insert_overwrite', partition_by='toDate(event_ts)') }}","handlingStrategy":"validation","validationCode":"if cfg.incremental_strategy == \"insert_overwrite\" {\n    assert!(!cfg.partition_by.as_ref().map_or(true, |p| p.is_empty()), \"partition_by required\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair insert_overwrite with a valid partition_by expression","Use immutable partition expressions (avoid now())","Confirm the target table supports the chosen partition key"],"tags":["clickhouse","dbt","configuration","partitioning"],"backgroundTag":"missing-required-config-field","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"}