Repository navigation
Conversation
dbt-clickhouse 1.10.4 dropped its check_schema_exists override, so the check now goes through SQLAdapter, which builds a relation from the given database and schema. Elementary passes its package database (the Elementary schema on ClickHouse) with the tests schema, and dbt-clickhouse rejects a relation whose database differs from its schema, so every `dbt test` fails in on-run-start with "Cannot set database <schema> in clickhouse!". Check the tests schema through a dispatched macro that, on ClickHouse, passes the schema as its own database. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
👋 @bim-ba |
bim-ba
requested a deployment
to
elementary_test_env
November 25, 2026 22:53 — with
GitHub Actions
Waiting
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
|
Thanks for tracking this down and for the fix! We went with a slightly different approach in #1107: on ClickHouse, |
Contributor
This branch was successfully deployed
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.
Summary
dbt-clickhouse 1.10.4 (released 2026-11-24) removed its Python
check_schema_existsoverride (ClickHouse/dbt-clickhouse#797). The check now goes throughSQLAdapter.check_schema_exists, which buildsRelation.create(database=..., schema=...), andClickHouseRelationraises whendatabaseis set and differs fromschema.On ClickHouse,
get_package_database_and_schemareturns[<schema>, <schema>]. In on-run-start,get_elementary_tests_schemaprobes the legacy tests schema with that database, so everydbt test/dbt buildfails before any test runs:Fix: both tests-schema checks go through a dispatched
tests_schema_exists. The default keepsadapter.check_schema_exists(database, schema), and the ClickHouse version passes the schema as its own database:I did not use the existing
schema_existsbecause its BigQuery and Postgres versions return fixed answers across databases, and that would change behaviour on those adapters.Evidence
Minimal project: one table model with
elementary.schema_changes, dbt-core 1.12.7, ClickHouse 26.10,elementary: +schema: elementary. Steps:dbt run --select elementary,dbt run,dbt test.master(b7fdff1)Runtime Error: Cannot set database <schema>_elementary in clickhouse!On this branch with dbt-clickhouse 1.10.4 and an existing
<schema>_elementary__testsdatabase, the legacy schema is still detected and used for the test temp tables (PASS=3).I did not run the repository's integration suite. The latest ClickHouse CI runs on
masterinstalled dbt-clickhouse 1.10.3, so they don't exercise 1.10.4 yet.Not covered here: with a non-empty
tests_schema_namevar,create_elementary_tests_schemastill callsapi.Relation.create(database=<schema>, schema=<schema><suffix>), which fails the same way on both adapter versions.Merge Danger
Door: two-way: macro-only change, and a revert restores the previous behaviour.
Blast Radius: small. Non-ClickHouse adapters run the same
adapter.check_schema_exists(database, schema)call as before, only through a dispatch.🤖 Generated with Claude Code
Summary by CodeRabbit