Skip to main content
The DataLakeCatalog database engine enables you to connect ClickHouse to external data catalogs and query open table format data without the need for data duplication. This transforms ClickHouse into a powerful query engine that works seamlessly with your existing data lake infrastructure.

Supported catalogs

The DataLakeCatalog engine supports the following data catalogs:
  • AWS Glue Catalog - For Iceberg tables in AWS environments
  • Databricks Unity Catalog - For Delta Lake and Iceberg tables
  • Hive Metastore - Traditional Hadoop ecosystem catalog
  • REST Catalogs - Any catalog supporting the Iceberg REST specification

Creating a database

You will need to enable the relevant settings below to use the DataLakeCatalog engine:
Databases with the DataLakeCatalog engine can be created using the following syntax:
The following settings are supported:

Referencing tables in namespaces

Namespace-aware name resolution is an experimental feature, disabled by default. Enable it with SET enable_table_namespaces = 1. A dotted path such as catalog_name.namespace.table is shorthand for the quoted form catalog_name.`namespace.table` and needs the setting in a query that reads from it; without the setting such a query is rejected and the quoted form has to be used. Statements that name their target table (INSERT, CREATE, DROP, ALTER, DESCRIBE and similar) accept the path regardless of the setting. A stored definition, such as the query of a view or a materialized view, is checked like a query each time it is analysed, starting with the CREATE statement; see below.
Data lake catalogs organize tables into namespaces, which can be nested to several levels. A table’s fully-qualified name inside the catalog is therefore namespace.table (or namespace1.namespace2.table for a nested namespace), and it can always be referenced by quoting that name as a single identifier:
You can also spell out every part with dots:
  • db.ns.table (three or more parts) in a table expression requires enable_table_namespaces and is read as the table path ns.table inside database db; it is then subject to the same two-part rule as a.b below, with a = db.
  • With enable_table_namespaces enabled, a two-part name a.b in a table expression is resolved as table b of database a, and also as table a.b of the current database if that database supports table namespaces (a data lake catalog) and a is not system. A catalog namespace named system is referenced as `system.t` or catalog_name.system.t. Database a must exist; when only one of the two tables exists it is used, and when both exist and the user can access both, the query fails with AMBIGUOUS_IDENTIFIER; if the user can access only one, that one is used. Other statements (EXISTS, DESCRIBE, INSERT, SHOW CREATE TABLE, DDL) always read a.b as database a, table b.
  • SQL stored in definitions (view and materialized view bodies, row policy conditions, mutations, column DEFAULT / MATERIALIZED / ALIAS expressions, ClickHouse dictionary source queries executed on the same server, SQL function bodies, the input queries of an Executable or ExecutablePool table, the query argument of the table function when a table created with CREATE TABLE ... AS f(...) is read) always reads a.b as database a, table b; the query argument of table functions view, viewIfPermitted, eval, obfuscate, explain and executable that such SQL calls keeps the two-part rule. In a stored definition, reference a catalog table as catalog_name.`ns.t` . The path form catalog_name.ns.t needs enable_table_namespaces each time the definition is analysed, with the settings in effect there: those of the user who creates the view, reads it, or inserts into the source table of a materialized view. A table TTL is analysed with the server settings, and a refreshable materialized view is not refreshed with the settings of the session that created it, so a session setting does not apply to them. To make a definition independent of these settings, use the quoted name or add SETTINGS enable_table_namespaces = 1 to the query inside it; the clause is ignored for a user with readonly = 1, the quoted name works for everyone. A definition is written to disk with the quoted name, so after a restart or ATTACH a path in a table expression of it no longer needs the setting, while a path as the right operand of IN (x IN catalog_name.ns.t) and as a column qualifier (catalog_name.ns.t.x) is stored as written and still needs it. A dictionary QUERY is kept as text, runs in the dictionary’s own context and needs the setting in the query’s own SETTINGS clause. In view bodies and column expressions, `ns.t` also works when the catalog is the current database at creation: it is qualified then and stored as catalog_name.`ns.t` .
The path form is accepted by every statement that parses a table name with the common table-name grammar: SELECT, INSERT, CREATE TABLE, DROP TABLE, ALTER TABLE, RENAME TABLE, OPTIMIZE TABLE, CHECK TABLE, SYSTEM commands, EXISTS TABLE, DESCRIBE, SHOW CREATE TABLE, SHOW COLUMNS and SHOW INDEXES. It is not accepted in BACKUP / RESTORE table lists, in access-control statements (GRANT, row and masking policies) or as the table argument of the remote table function; use the quoted form there. With the setting enabled, a column qualifier may spell the table path the same way: SELECT namespace.table.column FROM catalog_name.namespace.table. A back-quoted component containing a dot spells the same path as the separate parts, exactly as for column names: catalog_name.`a.b`.table, catalog_name.a.b.table and catalog_name.`a.b.table` denote the same table. Catalog objects whose native names contain literal dots cannot be told apart from nested paths, because the catalogs themselves spell nested namespaces with dots.

Examples

See below sections for examples of using the DataLakeCatalog engine:
  • Unity Catalog
  • Unity Catalog with Delta Lake and Iceberg tables With use_unity_catalog_v2 = 1, the unity catalog serves both Delta Lake and Iceberg tables, detecting the format of each table.
catalog_credential accepts an OAuth service principal as <client_id>:<client_secret>, a personal access token (dapi...), or a pre-obtained OAuth token.
  • Glue Catalog
  • OneLake Catalog Can be used by enabling allow_database_iceberg.
To authenticate without sharing a client secret, set onelake_bearer_token to a pre-obtained bearer token (scoped to https://storage.azure.com) instead of onelake_client_id/onelake_client_secret. ClickHouse does not refresh the token, so the database must be recreated after it expires.