Skip to content

Conversation

justbry
Copy link

@justbry justbry commented Sep 29, 2025

Summary

Add support for the METADATA_SCHEMA configuration option for DuckLake catalogs in DuckDB connections. This allows
users to specify which schema in the catalog server should store DuckLake metadata tables.

Changes

  • Core Configuration (sqlmesh/core/config/connection.py):
    • Added metadata_schema optional field to DuckDBAttachOptions
    • Updated to_sql() method to include METADATA_SCHEMA parameter in the DuckDB ATTACH statement when specified
  • Documentation (docs/integrations/engines/duckdb.md):
    • Added metadata_schema to YAML and Python configuration examples for DuckLake catalogs
    • Added comprehensive configuration options table documenting all DuckLake-specific parameters including the new
      metadata_schema option
  • Tests (tests/core/test_connection_config.py):
    • Added test_ducklake_metadata_schema() with three test cases:
      • Verifies METADATA_SCHEMA is included in SQL when specified
      • Confirms default behavior (no METADATA_SCHEMA) when not specified
      • Tests interaction with other DuckLake options (data_path, encrypted)

Motivation

DuckLake users need the ability to control where metadata tables are stored within the catalog server. The default
main schema may not always be appropriate for organizational or security requirements. This configuration option
provides that flexibility while maintaining backward compatibility (defaults to DuckLake's default behavior when not
specified).

Example Usage

gateways:
my_gateway:
connection:
type: duckdb
catalogs:
ducklake_catalog:
type: ducklake
path: catalog.ducklake
metadata_schema: custom_workspace

Test Plan

  • Unit tests verify SQL generation with and without metadata_schema
  • Unit tests confirm compatibility with other DuckLake options
  • Documentation updated with examples

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


rmac seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@georgesittas georgesittas left a comment

Choose a reason for hiding this comment

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

Hey @justbry, thank you for the PR. Where is METADATA_SCHEMA documented?

@justbry
Copy link
Author

justbry commented Oct 2, 2025

METADATA_SCHEMA is documented in docs/integrations/engines/duckdb.md

https://github.com/TobikoData/sqlmesh/pull/5456/files#diff-de5de8bb701edca7af9847e114df48bfceefda5f991eaa196a2dfe765a5af9a3

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.

3 participants