Repository navigation
fix: return no database for ClickHouse in get_package_database_and_schema - #1107
Conversation
…hema ClickHouse has no database level, and dbt-clickhouse 1.10.4 rejects a relation whose database differs from its schema. Returning the schema as the database made check_schema_exists(<schema>, <schema>__tests) raise 'Cannot set database ... in clickhouse!' on every dbt test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
👋 @EladBarkay |
✅ 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. |
dbt-clickhouse has no dbname field and no database level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve conflict with #1107: keep secure/verify, drop dbname. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
On dbt-clickhouse 1.10.4, every
dbt testwith the Elementary package fails withCannot set database <schema> in clickhouse!.clickhouse__get_package_database_and_schemareturns[schema, schema], so it makes up a database equal to the schema.get_elementary_tests_schemathen callsadapter.check_schema_exists(<schema>, <schema>__tests). dbt-clickhouse 1.10.4 (ClickHouse/dbt-clickhouse#797) removed itscheck_schema_existsoverride, so the call reachesSQLAdapter.check_schema_exists. That builds aClickHouseRelationwith database != schema, whichClickHouseRelation.__post_init__rejects. Upstream issue: ClickHouse/dbt-clickhouse#831.Fix
ClickHouse has no database level: the dbt schema is the ClickHouse database, and
ClickHouseRelationalways resetspath.databaseto''. Returning[none, schema]matches what other adapters without a database level get (Spark returnsNone). All callers either build relations from the value, which dbt-clickhouse normalizes to'', or ignore it on ClickHouse.The one direct use of the value on ClickHouse was
dbnamein the generated CLI profile. That line is removed: dbt-clickhouse has nodbnamefield (no alias either), so it was always ignored, and existing profiles that still contain it keep working.This also fixes
create_elementary_tests_schemawhentests_schema_nameis set, because it buildsRelation.create(database=<schema>, schema=<schema><suffix>), which fails on every dbt-clickhouse version.Alternative to #1102: this removes the made-up database instead of special-casing
check_schema_existsfor ClickHouse.🤖 Generated with Claude Code
Summary by CodeRabbit