fix: Avoid injected settings to reach manifest and overselect on state:modified#677
fix: Avoid injected settings to reach manifest and overselect on state:modified#67729antonioac wants to merge 6 commits into
state:modified#677Conversation
|
Ey @29antonioac , thanks as always for reporting it and for sharing a PR 🙇 I was wondering that the solution feels like should go in the other direction: Instead of skipping it, any setting the adapter add should be recorded in the manifest in both situations. Out of curiosity, have you checked it we can do it otherwise? Maybe we need to change when this setting is added to make sure it's always included |
|
Hey mate, no problem! Happy to support OSS 😄 Please take my opinion with a pinch of salt: I'm not a dbt expert or power user, just a guy trying to help his colleagues, I feel more comfortable with ClickHouse than dbt in general, so I can be missing details 😄 . I was wondering the same, maybe the manifest should get all settings of the model, including the injected ones. However, when finding the issue because of The setting only applies to MergeTree tables, not sure if I'm happy to look for a way to get the manifest with whatever setting the adapter injects at |
Agree 100% that it wouldn't be nice at all, but after giving a second thought, maybe it's worth it to flag them 🤔. If some config change, like Would you check if there's indeed a way to do that? Btw, I thought version checking may get in the middle of it, so assume in your checks that the version checking is removed. I already removed that code here https://github.com/ClickHouse/dbt-clickhouse/pull/678/changes |
…als and manifest are available without a connection
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit bb857a2. Configure here.
| not credentials.allow_automatic_deduplication | ||
| and materialization_type in DEDUP_WINDOW_SETTING_SUPPORTED_MATERIALIZATION | ||
| ): | ||
| settings[DEDUP_WINDOW_SETTING] = '0' |
There was a problem hiding this comment.
Missing server version gate
Medium Severity
The get_injected_model_settings function now unconditionally adds replicated_deduplication_window='0' when automatic deduplication is disabled. This change removes a prior server version check (for ClickHouse >= 22.7.1.2484), meaning older ClickHouse clusters will now receive this setting, which was previously skipped.
Reviewed by Cursor Bugbot for commit bb857a2. Configure here.
|
@koletzilla It's not the nicest solution, but with Claude and inspecting dbt core it seems there is a point where the manifest is resolved at parse time and we can inject settings there instead: It feels a bit hacky though. Also the solution in the new test to read explicitly the manifest without I removed the version comparison too as you mentioned 😄 |


Summary
Fixes a bug where
get_model_settingsmutatedmodel['config']['settings']in-place, causing adapter-injected settings (e.g.replicated_deduplication_window='0') to be persisted intomanifest.jsonafterdbt run. This produced a permanent asymmetry with manifests generated bydbt parseordbt ls, which never callget_model_settingsand therefore produced a clean manifest. The mismatch caused--select state:modified+ --deferto reportconfig_changedon every affected model on every subsequent run, even when nothing had changed.Fix: deep-copy the settings dict in
get_model_settingsbefore passing it toupdate_model_settings, so the originalmodel['config']is never touched.Related to #372.
Closes #676
Checklist