-
Notifications
You must be signed in to change notification settings - Fork 313
Open
Description
Problem
When using SQLMesh with DuckLake catalogs, VIEW definitions created by SQLMesh hardcode the catalog name specified in config.yaml. This prevents users from using different ATTACH aliases when connecting to the DuckLake database from other applications.
Environment
- SQLMesh version: latest
- DuckDB version: 1.2.x
- Catalog type: DuckLake
Configuration
gateways:
dp_gateway:
connection:
type: duckdb
catalogs:
my_ducklake: # <-- This name gets hardcoded into VIEW definitions
type: ducklake
path: ./data/catalog/ducklake.db
data_path: s3://bucket/ducklake/Current Behavior
SQLMesh creates VIEWs with hardcoded catalog references:
-- VIEW definition in ducklake_view table
SELECT * FROM my_ducklake.sqlmesh__dwh.dwh__fact_account_item__114180348This means:
- ✅
ATTACH 'ducklake:./ducklake.db' AS my_ducklake→ Works - ❌
ATTACH 'ducklake:./ducklake.db' AS ducklake→ Fails (catalog not found)
Expected Behavior
VIEWs should work regardless of the ATTACH alias used. Possible solutions:
- Use relative catalog references in VIEW definitions
- Provide a configuration option to specify the "external" catalog name
- Document this limitation clearly
Use Case
We use Apache Superset to query DuckLake data. Superset ATTACHes the catalog as ducklake, but SQLMesh created VIEWs referencing my_ducklake. This forces us to either:
- Reconfigure Superset (not always possible)
- Rebuild all SQLMesh models with a different catalog name
- Use TABLE kind instead of VIEW (increases storage)
Workaround
Currently, we must ensure the catalog name in config.yaml matches exactly what downstream applications use for ATTACH.
Related
- DuckDB VIEW qualified name resolution: VIEW created after a USING statement fails when queried without a USING statement, even when queried with its qualified name duckdb/duckdb#16064
Metadata
Metadata
Assignees
Labels
No labels