Skip to content

DuckLake: VIEW definitions hardcode catalog name, preventing flexible ATTACH aliases #5613

@KL-Iguchi-Naoto

Description

@KL-Iguchi-Naoto

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__114180348

This 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:

  1. Use relative catalog references in VIEW definitions
  2. Provide a configuration option to specify the "external" catalog name
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions