Repository navigation
fix: restore schema detection with distinct database names - #834
Open
samhoon000 wants to merge 2 commits into
Open
samhoon000 wants to merge 2 commits into
samhoon000 wants to merge 2 commits into
Conversation
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
Restore
adapter.check_schema_exists(database, schema)for callers that pass different names. Fixes #831.dbt Core's implementation constructs an information-schema relation before dispatching the lookup. ClickHouse uses the dbt schema as its database name, so a different logical database name caused relation construction to raise. The adapter now normalizes the database argument at this entry point and delegates to dbt's existing lookup macro.
Testing
python -m pytest -q --confcutdir=tests/unit tests/unit— 158 passed. The new tests reproduce the exception on the base branch and cover existing and missing schemas with matching, absent, and differing database arguments.time.tzset(), which is unavailable on Windows.Checklist
Note
Low Risk
Small, targeted adapter override for schema lookup with added unit and integration tests; no auth or data-path changes.
Overview
Restores
adapter.check_schema_exists(database, schema)when dbt packages pass a logicaldatabasename that differs from the ClickHouse database (the dbtschema). The adapter now overrides the method and calls the parent lookup with(schema, schema), so relation construction no longer fails and existence is still checked againstsystem.databasesvia the existing macro.Tests: integration coverage now exercises Jinja calls with an explicit mismatched database name; new unit tests assert the macro always receives the schema as the lookup key regardless of the
databaseargument.Reviewed by Cursor Bugbot for commit 115b898. Bugbot is set up for automated code reviews on this repo. Configure here.