{"record":{"id":"83db76ab49bccd0c","repo":"dbt-labs/dbt-core","slug":"cannot-apply-incremental-predicates-with-strateg","errorCode":null,"errorMessage":"Cannot apply incremental predicates with '{strategy}' strategy.","messagePattern":"Cannot apply incremental predicates with '(.+?)' strategy\\.","errorType":"validation","errorClass":"AdapterError","httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/metadata/clickhouse/mod.rs","lineNumber":917,"sourceCode":"    ) {\n        return err(format!(\n            \"The incremental strategy '{strategy}' is not valid for ClickHouse.\"\n        ));\n    }\n    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),","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/metadata/clickhouse/mod.rs#L899-L935","documentation":"Incremental predicates (predicates applied during the incremental run) are only meaningful for the delete_insert and microbatch strategies on ClickHouse. validate_incremental_strategy rejects any model that supplies incremental_predicates together with one of the other strategies (legacy, append, insert_overwrite).","triggerScenarios":"Setting incremental_predicates on a ClickHouse incremental model whose incremental_strategy is 'legacy', 'append', or 'insert_overwrite'; inheriting predicates from a base config while overriding the strategy.","commonSituations":"Copying a Snowflake/Postgres model config (where predicates pair with delete strategies) onto ClickHouse with a different strategy; combining insert_overwrite partition pruning with leftover predicates from a template.","solutions":["Remove incremental_predicates from the model config, or","Change incremental_strategy to 'delete_insert' or 'microbatch' where predicates are supported","For partition-scoped processing with insert_overwrite, use partition_by instead of predicates"],"exampleFix":"// before\n{{ config(materialized='incremental', incremental_strategy='insert_overwrite', incremental_predicates=[\"status = 'active'\"]) }}\n// after\n{{ config(materialized='incremental', incremental_strategy='delete_insert', unique_key='id', incremental_predicates=[\"status = 'active'\"]) }}","handlingStrategy":"validation","validationCode":"if cfg.incremental_predicates.is_some()\n    && !matches!(cfg.incremental_strategy.as_str(), \"delete_insert\" | \"microbatch\") {\n    panic!(\"incremental_predicates only valid with delete_insert or microbatch\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip incremental_predicates when changing strategy to append/insert_overwrite","Audit inherited/base configs for predicates","Use partition_by for partition-scoped processing instead of predicates with insert_overwrite"],"tags":["clickhouse","dbt","configuration","predicates"],"backgroundTag":"unsupported-operation","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"}