Skip to content

fix(clickhouse): strip virtual catalog from view sources - #5940

Merged
mday-io merged 1 commit into
SQLMesh:mainfrom
mday-io:mday/fix-clickhouse-create-view-catalog
Aug 6, 2026
Merged

fix(clickhouse): strip virtual catalog from view sources#5940
mday-io merged 1 commit into
SQLMesh:mainfrom
mday-io:mday/fix-clickhouse-create-view-catalog

Conversation

@mday-io

@mday-io mday-io commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • strip ClickHouse's configured virtual catalog from physical source tables in CREATE VIEW queries
  • preserve the caller's query expression and reject unexpected source catalogs

Why

The inherited catalog handling normalized the virtual view target but left synthetic three-part source names in the query. ClickHouse only accepts two-part database.table names, so gateway-managed virtual-layer promotion failed after creating the physical object.

Validation

  • make style
  • make fast-test
  • pytest tests/core/engine_adapter/test_clickhouse.py

Closes #5938

Signed-off-by: mday-io <mdaytn@gmail.com>

@StuffbyYuki StuffbyYuki left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we use _strip_virtual_catalog() instead of inlining table.set("catalog", None)

@mday-io

mday-io commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

That helper creates a separate table object, so it wouldn’t update the table inside the view query. We also need to catch unexpected catalogs here, which is why this code handles it directly

@mday-io
mday-io merged commit 3e10801 into SQLMesh:main Aug 6, 2026
32 checks passed
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.

ClickHouse virtual catalog is not stripped from CREATE VIEW source queries

2 participants