ClickHouse virtual catalog is not stripped from CREATE TABLE AS SELECT / INSERT source queries (physical layer)
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Start by comparing the physical-table _create_table and INSERT paths with the create_view fix in issues #5938 and #5940. Trace how source-query table identifiers retain the injected virtual catalog, then add coverage for the ClickHouse CTAS and INSERT cases. Done when source queries sent to ClickHouse use supported identifiers and the reproduced sqlmesh plan completes without a syntax error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
This is a sibling of #5938 / #5940 ("virtual catalog not stripped from CREATE VIEW source queries"). That fix covered create_view, but the same bug still exists on the physical-table path: _create_table (CTAS) and the INSERT paths strip the injected virtual catalog only from the target table name, not from the source query's FROM tables. As a result ClickHouse receives a 3-part identifier and fails with SYNTAX_ERROR (code 62) whenever a FULL (or incremental) model reads from another model.
Environment
- sqlmesh 0.236.1
- A ClickHouse gateway (catalog-unsupported) coexisting with a catalog-aware gateway (BigQuery) in the same project, so
scheduler.get_default_catalog_per_gateway()injects a virtual catalog (__ch__) into the ClickHouse adapter. default_gateway: ch
Reproduction
config.yaml:
model_defaults:
start: 2025-01-01
dialect: clickhouse
gateways:
ch:
connection:
type: clickhouse
host: <host>
username: <user>
password: <pw>
state_connection: { type: postgres, host: ..., port: 5432, user: ..., password: ..., database: sqlmesh }
bigquery: # <-- merely defining a catalog-aware gateway triggers virtual-catalog injection
connection:
type: bigquery
method: oauth
project: my-project
location: EU
state_connection: { type: postgres, ... }
default_gateway: ch
models/silver/test_table.sql:
MODEL (name silver.test_table, kind FULL);
SELECT 1 AS first_column;
models/gold/test_table.sql:
MODEL (name gold.test_table, kind FULL);
SELECT *, 2 AS second_column FROM silver.test_table;
Run:
sqlmesh plan
Actual behaviour
"__ch__"."gold"."test_table"
DatabaseError:
Code: 62. DB::Exception: Syntax error: failed at position 512 (AS):
AS "test_table") AS "_subquery". ... (SYNTAX_ERROR)
Error: Plan application failed.
The statement sent to ClickHouse for the physical gold table is:
CREATE TABLE "sqlmesh__gold"."gold__test_table__..." AS
SELECT ...
FROM "__ch__"."sqlmesh__silver"."silver__test_table__..." AS "test_table" -- <-- 3-part FQN, invalid in ClickHouse
(The nested source table still carries __ch__; ClickHouse only supports database.table.)
Impact
Gateway-managed virtual-layer promotion cannot complete for ClickHouse models
in affected multi-gateway projects. Physical objects may be created before the
promotion failure, leaving a partially applied plan to clean up.
Environment
SQLMesh: 0.236.1
ClickHouse: 26.7
- Ngôn ngữ chính
- Python
- Star
- 3.3k
- Fork
- 471
- Merge trung bình
- 6 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 35
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SQLMesh/sqlmesh
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
SQLMesh/sqlmesh#6008 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
VSCode Extension: SQLMesh LSP crashes on startup: ImportError: cannot import name 'WorkspaceDiagnosticRefreshRequest' with lsprotocol 2025.xCó thể đã có người làm @boomesh11 đã nhận 15 ngày trước. Đang mởBug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Improvement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
SQLMesh/sqlmesh#5696 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của SQLMesh/sqlmesh
Issue tương tự
-
[BUG][Low–Medium] founder_numbers.py silently reads a SAFE discount or pool target given as a fraction (0.2) as 0.2%Có thể đã có người làm @sumitkhond111-del đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bmad-code-org/BMAD-METHOD#3358 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
open-mmlab/mmcv#3352 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
OpenGithubs/weekly#263 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
comp/cli P3 type/feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
NousResearch/hermes-agent#162784 ·
Maintainer thường phản hồi trong vòng 1 ngày