Repository navigation
Conversation
|
Docs drift check: resolved, docs now match this PR's changes. |
…erts_only and predicates errors
1 of 2 tasks
koletzilla
previously approved these changes
Nov 16, 2026
koletzilla
self-requested a review
November 16, 2026 12:10
koletzilla
reviewed
Nov 16, 2026
koletzilla
approved these changes
Nov 16, 2026
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #258
Summary
When no
unique_keywas set, the incremental materialization (on non-distributed path) did fall back toinserts_onlymode, ignoring the incremental strategy, schema changes and potentially creating duplicate rows.This PR fixes this issue via the following changes:
unique_keyonincrementalmaterialization no longer falls back to theinserts_onlymode. users who previously relied on this behavior when setting explicit incremental strategies that requireunique_keywill now see a validation error instead of the silent fallback.unique_keyis defined is nowappend(now aligned with other adapters and default__get_incremental_default_sql). the previous defaultsdelete+insert(with lw deletes) andlegacy(without lw deletes) did silently fall back toinserts_only(which is replaced byappend), so the default materialization behavior doesn't practically change. becauseappenddoesn't handleincremental_predicates, it will fail the validation if configured (e.g. this will now fail:config(materialized='incremental', incremental_predicates=['1 = 1'])).adapter.validate_incremental_strategynow runs early on every materialization, even in full-refresh or initial materializations. previously the validation was only triggered on the branches that run the incremental strategy. this gives users an early feedback whether their model is misconfigured.appendandinserts_only"strategies" no longer insert into wrong columns when new columns are added out of order or existing column order is changed. this resolves the issue mentioned in the comment of 258.Checklist
Delete items not relevant to your PR:
docswas updated with further explanations or tutorialsNote
Medium Risk
Changes default incremental behavior and turns previously silent misconfigurations into hard failures, which may break existing projects that relied on fallback append or missing-key strategies.
Overview
Fixes incremental models without a
unique_keyno longer silently falling back to append-only behavior that ignoredincremental_strategy, schema-change handling, and could duplicate rows.Default strategy is now
appendwhen nounique_keyis set (viacalculate_incremental_strategy); with aunique_key, defaults remaindelete+insertorlegacybased onuse_lw_deletes.inserts_onlyis deprecated in favor ofincremental_strategy='append', with a warning that fails runs under--warn-error.Validation runs at materialization start (including first/full refresh), not only on incremental branches. Models that set
legacy,delete+insert, ormicrobatchwithoutunique_keynow fail with a clear error instead of appending.incremental_predicateswith non–delete+insert/microbatch strategies (including defaultappend) also fail validation.Append/
inserts_onlyinserts now callclickhouse__insert_intowithuse_columns_from_sql=Trueso column order matches the model SQL. Docs and changelog reflect the new defaults and requirements; tests cover deprecation, validation failures, and append/schema-change behavior.Reviewed by Cursor Bugbot for commit 62cbde0. Bugbot is set up for automated code reviews on this repo. Configure here.