Skip to content

feat: opt-in create_if_not_exists for concurrent table creation - #722

Open
JoepBeurskens wants to merge 7 commits into
ClickHouse:mainfrom
JoepBeurskens:fix/incremental-create-if-not-exists
Open

JoepBeurskens wants to merge 7 commits into
ClickHouse:mainfrom
JoepBeurskens:fix/incremental-create-if-not-exists

Conversation

@JoepBeurskens

Copy link
Copy Markdown

Summary

Fixes #721. See CHANGELOG. Adds an opt-in create_if_not_exists model config; default off; not for Replicated engines.

Checklist

Delete items not relevant to your PR:

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


JoepBeurskens seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread dbt/include/clickhouse/macros/materializations/table.sql Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit f0520d5. Configure here.

Comment thread dbt/include/clickhouse/macros/materializations/table.sql Outdated
@koletzilla
koletzilla requested review from koletzilla and a balanced review from Copilot August 27, 2026 12:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in atomic table creation intended to mitigate concurrent first-creation races.

Changes:

  • Adds create_if_not_exists SQL generation and compatibility checks.
  • Adds integration coverage for enabled and default behavior.
  • Documents the feature in the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
table.sql Implements atomic conditional table creation.
test_create_if_not_exists.py Tests generated SQL and row counts.
CHANGELOG.md Adds the user-facing feature entry.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dbt/include/clickhouse/macros/materializations/table.sql Outdated
Comment thread tests/integration/adapter/incremental/test_create_if_not_exists.py Outdated
Comment thread CHANGELOG.md Outdated
JoepBeurskens and others added 2 commits August 28, 2026 08:36
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional CREATE TABLE IF NOT EXISTS to avoid Code 57 when concurrent runs build the same table

3 participants