⌘K ctrl+k
Search Shortcut cmd + k | ctrl + k

Unity Catalog Extension

The unity_catalog extension attaches a Unity Catalog catalog, on Databricks or Unity Catalog OSS, as a DuckDB database. You can list, read, insert into, and create its Delta Lake tables. It uses the delta extension to access the tables.

For implementation details, see the “Delta Grows Up: Writes, Unity Catalog and Time Travel” blog post.

Note Both extensions are available on a subset of platforms.

Installing and Loading

The unity_catalog extension will be transparently autoloaded on first use from the official extension repository. It loads the delta extension itself. If you would like to install and load it manually, run:

INSTALL AND LOAD unity_catalog;

Usage

To connect to Unity Catalog on Databricks or Unity Catalog OSS, create a secret with your token, endpoint, and region, then attach a catalog:

CREATE SECRET (
    TYPE unity_catalog,
    TOKEN 'token',
    ENDPOINT 'endpoint',
    AWS_REGION 'region'
);
ATTACH 'catalog_name' AS my_catalog (TYPE unity_catalog, DEFAULT_SCHEMA 'main');
  • ENDPOINT is the Unity Catalog REST API endpoint. For Databricks, it is your Workspace URL, typically https://instance.cloud.databricks.com/.
  • TOKEN is a credential. For Databricks, it can be a personal access token with unity-catalog scope; see Access Control in Unity Catalog for the other options. For Unity Catalog OSS, see the OSS Unity Catalog documentation.
  • AWS_REGION is the region of the S3 storage that holds the tables. DuckDB uses it for tables on S3 when the vended credentials name no region. Tables on GCS or Azure do not use it.

To read and write the table files, DuckDB uses the storage credentials that Unity Catalog vends for each table; see Storage Credentials.

Note Only Databricks reports a default namespace. When you attach a Unity Catalog OSS catalog, set DEFAULT_SCHEMA to use table names without a schema. Since v2.0.1, fully qualified table names work without it, except in a schema named main, which needs DEFAULT_SCHEMA; before, queries could fail even with fully qualified names. ATTACH does not check that the schema exists.

Storage Credentials

For each table that DuckDB reads or writes, it asks Unity Catalog for temporary credentials and creates a secret from them, scoped to the table's location. With USE_IRC_SCAN_PLAN, a planned scan's secrets are scoped to the prefixes that the server returns with them instead. Since v2.0.1, this works for all three clouds; before, only AWS credentials were used:

  • s3://: an S3 secret with the vended key, secret, and session token.
  • gs:// and gcs://: a GCS secret with the vended OAuth bearer token, which the delta extension can use since v2.0.1.
  • abfss://, abfs://, az://, and azure://: an Azure secret with the vended SAS token. This needs the azure extension.

Since v2.0.1, a vended secret exists only for the current transaction, so it does not show up in duckdb_secrets() after the transaction ends, and transactions that read the same table at the same time no longer conflict. A later transaction that reads the table's files directly, e.g., with read_parquet or glob, does not have it; read the table through the catalog in the same transaction first.

DuckDB uses the secret with the longest scope that matches a path. A vended secret scoped to the table's location therefore takes precedence over a secret of yours for the bucket, the container, or the storage account.

A secret of your own for the storage, e.g., an S3 secret, a GCS secret with HMAC keys, or an Azure secret, is still needed:

  • when Unity Catalog answers the credentials request without credentials for the table's cloud. Since v2.0.1, DuckDB then creates no secret, logs a warning (log type unity_catalog, see Logging), and uses yours. If the credentials request itself fails, e.g., because the server does not offer it or refuses it, the query fails.
  • to create an external table, with CREATE TABLE or CREATE TABLE ... AS SELECT: DuckDB writes its first version before Unity Catalog knows the table, so nothing is vended for it. A managed table gets credentials for its staging location.

Tables on local storage (file://) need no secret.

Attach Options

When attaching a Unity Catalog catalog, you can pass the following options to ATTACH:

Option Type Default Description
SECRET VARCHAR unnamed secret Name of the unity_catalog secret to use. Without it, the unnamed unity_catalog secret is used.
DEFAULT_SCHEMA VARCHAR detected Schema that unqualified table names resolve to. Without it, DuckDB asks the server for the workspace's default namespace.
READ_ONLY BOOLEAN false Attach the catalog in read-only mode.
USE_IRC_SCAN_PLAN BOOLEAN false Plan scans on the server (Databricks only); see Server-Side Scan Planning.

Reading

Tables are named catalog.schema.table; names without a schema resolve to DEFAULT_SCHEMA:

SHOW ALL TABLES;
SELECT * FROM my_catalog.my_schema.my_table LIMIT 10;

Warning Before v2.0.1, the partition columns of a partitioned table with column mapping read as NULL in every row, without an error. Unity Catalog suggests column mapping for managed tables, so this affects many of them.

Time Travel

New Time travel by timestamp was introduced in DuckDB 2.0.

To read a table as of a version or a point in time, use the AT clause:

SELECT * FROM my_catalog.my_schema.my_table AT (VERSION => 5);
SELECT * FROM my_catalog.my_schema.my_table AT (TIMESTAMP => TIMESTAMPTZ '2026-10-01 12:00:00+00');

A timestamp reads the latest version committed at or before that time. A timestamp before the table's first commit or later than the current time fails with an error.

Writing

To append rows, use INSERT INTO:

INSERT INTO my_catalog.my_schema.my_table VALUES (1, 'hello');
INSERT INTO my_catalog.my_schema.my_table SELECT * FROM other_table;

Since v2.0.1, INSERT also writes to tables with column mapping (name or id mode) that are partitioned or have struct, list, or map columns, managed and external alike.

Data Types

Unity Catalog column types map to DuckDB types as follows. Since v1.5.6, DuckDB reads them from the table's Delta log.

  • timestamp maps to TIMESTAMP WITH TIME ZONE and, since v1.5.6, timestamp_ntz to TIMESTAMP.
  • Since v1.5.6, a column of a type that DuckDB cannot read is listed with the type UNKNOWN, e.g., in DESCRIBE. Reading the table fails with an error that names the column.

VARIANT Columns

New Support for VARIANT columns was introduced in DuckDB 2.0.

Unity Catalog's variant maps to VARIANT. VARIANT columns can be read whether their files are shredded or not. Inserts write shredded variants if the table sets delta.enableVariantShredding. An INSERT into a table with a VARIANT inside a struct, list, or map fails with an error.

Creating Tables

New This feature was introduced in DuckDB 2.0.

CREATE TABLE in a Unity Catalog schema writes the first version of a new Delta table and registers the table with Unity Catalog.

Without a location, the table is a managed table: Unity Catalog chooses where it is stored, and the table uses catalog-managed commits:

CREATE TABLE my_catalog.my_schema.my_table (id INTEGER, name VARCHAR);

With the location option, the table is an external table at that location. The location can be any expression that evaluates to an absolute path or a URI:

CREATE TABLE my_catalog.my_schema.my_external_table (id INTEGER, name VARCHAR)
WITH (location = 's3://my_bucket/path');

Since v2.0.1, a managed table takes the Delta table properties that Unity Catalog suggests for it, e.g., column mapping in name mode, as Spark does. So a managed table that DuckDB creates may be column-mapped; there is no option to turn this off. DuckDB before v2.0.1 reads the partition columns of such a table as NULL and cannot write to it if it is partitioned or has nested columns.

Both managed and external tables can be partitioned:

CREATE TABLE my_catalog.my_schema.my_partitioned_table (id INTEGER, part VARCHAR)
PARTITIONED BY (part);

CREATE TABLE IF NOT EXISTS does nothing if Unity Catalog already has a table with this name.

For the forms and options that CREATE TABLE does not support, see Limitations.

Warning Unity Catalog registers the table while CREATE TABLE runs, so a ROLLBACK of the surrounding transaction does not remove the table.

If this session has listed a table with the same name, CREATE TABLE fails with “already exists”, even if the table has since been dropped by another client. To create it again, DETACH and ATTACH the catalog.

Creating Tables from a Query

New This feature was introduced in DuckDB 2.0.1.

CREATE TABLE ... AS SELECT creates a table with the query's columns and rows. As with CREATE TABLE, a table without a location is a managed table, and one with the location option is an external table. Both can be partitioned:

CREATE TABLE my_catalog.my_schema.my_ctas_table AS
    SELECT * FROM other_table;

CREATE TABLE my_catalog.my_schema.my_external_ctas_table PARTITIONED BY (part)
WITH (location = 's3://my_bucket/other_path') AS
    SELECT * FROM other_table;

The delta extension writes the rows and the table's schema as version 0 of the new table, in one commit at the end of the statement. Then Unity Catalog registers the table. For an external table, DuckDB needs a storage secret of your own for the location; see Storage Credentials.

  • Unity Catalog checks the name before the query runs. If it has a table with this name, the statement fails, and with IF NOT EXISTS the query does not run.
  • For a new name, an external table needs a location without files under _delta_log, even with IF NOT EXISTS; on local storage, CREATE TABLE ... AS SELECT also refuses an empty _delta_log directory. The rule about files also holds for an external CREATE TABLE: since v2.0.1, CREATE TABLE IF NOT EXISTS with the location of an existing Delta table fails instead of registering that table.
  • If the query fails, the statement registers nothing and removes the files it wrote, on a best-effort basis.
  • If the registration fails or its reply is lost, the written files may stay behind; DuckDB then logs a warning with their location. For an external table, an interruption between the commit and the registration leaves an unregistered table that blocks a retry at that location: remove its files, or register the table with Unity Catalog by other means. A managed table is staged anew on each attempt, and its staging location belongs to Unity Catalog: do not remove files there.
  • As with CREATE TABLE, a ROLLBACK does not remove the table.
  • For a managed table, Unity Catalog stages the table while the statement is planned, before its columns are checked. A statement that registers no table, such as EXPLAIN, a prepared statement that is never executed, a statement with a column type that Delta cannot store, or a query that fails, leaves a staged, unregistered table in Unity Catalog.
  • The staging credentials of a managed table are not refreshed during the statement, so a long-running query can outlive them.

Checkpointing

Since v1.5.1, unity_catalog_checkpoint_table compacts the Delta log of a table into a checkpoint file, which speeds up reads of tables with long logs. Pass the table name as a string, either fully qualified or relative to the catalog and schema set with USE:

CALL unity_catalog_checkpoint_table('my_catalog.my_schema.my_table');

The CHECKPOINT statement does not apply to Unity Catalog tables and fails with an error.

Server-Side Scan Planning

New This feature was introduced in DuckDB 2.0.

Databricks can plan scans on the server, through the Iceberg REST Catalog (IRC) API of Unity Catalog. The API uses catalog-wide statistics, which can improve filtering and reduce the number of files that a query scans. Unity Catalog OSS does not offer this API.

With USE_IRC_SCAN_PLAN true, DuckDB sends each scan's filters to the server and reads only the files that it returns, with their delete files. DuckDB still applies the filters itself:

ATTACH 'catalog_name' AS my_catalog (
    TYPE unity_catalog,
    DEFAULT_SCHEMA 'main',
    USE_IRC_SCAN_PLAN true
);
  • If the server cannot plan a scan, e.g., because it does not offer the API or refuses the table, DuckDB reads the table through its Delta log instead, and does not try scan planning again on this attached catalog for 15 minutes.
  • Time travel queries (AT (...)) always read through the Delta log.
  • Since v2.0.1, a partitioned or column-mapped Delta table always reads through its Delta log, without asking the server for a scan plan.
  • Positional delete files and deletion vectors are applied. A table with equality delete files fails with an error; to read it, attach the catalog without USE_IRC_SCAN_PLAN.

Catalog-Managed Commits

Managed tables in Databricks and in Unity Catalog OSS may use catalog-managed commits (Catalog-Coordinated Commits / CCv2), where Unity Catalog coordinates commits rather than writers committing directly to the Delta log. Since v1.5.2 (v1.5.5 for Unity Catalog OSS), DuckDB uses this protocol when the attached table requires it. INSERT statements are identical in syntax, but they commit through the catalog-managed write protocol, so Unity Catalog coordinates concurrent writers. For details, see the “Delta Grows Up: Writes, Unity Catalog and Time Travel” blog post.

A managed table that DuckDB creates uses catalog-managed commits. Tables created by other clients, e.g., Spark or the Unity Catalog CLI, are read and written the same way.

Features

This extension supports:

  • Listing available tables: SHOW ALL TABLES;
  • Interacting with tables using standard SQL: SELECT * FROM catalog.schema.table;
  • Time travel: SELECT * FROM ... AT (VERSION => ...); and SELECT * FROM ... AT (TIMESTAMP => ...);
  • Inserts: INSERT INTO ... VALUES (...);
  • Creating managed and external tables: CREATE TABLE ... (...); and, since v2.0.1, CREATE TABLE ... AS SELECT ...;
  • Checkpointing individual tables (since v1.5.1): CALL unity_catalog_checkpoint_table('my_catalog.my_schema.my_table');

Limitations

  • DELETE and UPDATE are not supported.
  • DROP TABLE and ALTER TABLE are not supported, nor is creating or changing views or schemas.
  • Inserts into a table with column DEFAULT values or generated columns fail with an error, as DuckDB cannot compute these columns yet.
  • Reading a table with an INTERVAL column fails with an error, as Delta intervals and DuckDB's INTERVAL differ in meaning.
  • The following CREATE TABLE forms and options are not supported and fail with an error:
    • CREATE OR REPLACE TABLE, with or without AS SELECT
    • before v2.0.1, CREATE TABLE ... AS SELECT
    • constraints, including NOT NULL and PRIMARY KEY
    • column DEFAULT values and generated columns
    • columns of a type that Delta cannot store, e.g., TIME
    • SORTED BY
    • WITH options other than location: unlike with the delta extension, Delta table properties cannot be set

Supported Platforms

The unity_catalog and delta extensions support the following platforms:

  • Linux (x86_64 and ARM64): linux_amd64 and linux_arm64
  • macOS Intel and Apple Silicon: osx_amd64 and osx_arm64
  • Windows AMD64: windows_amd64

Support for the other DuckDB platforms is work-in-progress.

© 2026 DuckDB Foundation, Amsterdam NL
DuckDB Home Code of Conduct Trademark Use Blog