Apache Iceberg™ Tables
TiDB Cloud Lake can connect to Apache Iceberg™ catalogs so that you can query Iceberg tables without loading their data into Fuse tables. You can also create and write Iceberg tables when the connected catalog supports write operations.
When to Use Iceberg
Use Iceberg when:
- Your data is already managed by an Iceberg catalog.
- Multiple query engines need to share the same table metadata and object storage.
- You need Iceberg capabilities such as schema evolution and snapshots.
- You want to query or write Iceberg tables from TiDB Cloud Lake.
Create an Iceberg Catalog
Create a catalog before accessing Iceberg databases and tables.
Syntax
CREATE CATALOG <catalog_name>
TYPE = ICEBERG
CONNECTION = (
TYPE = '<catalog_type>'
[ ADDRESS = '<catalog_address>' ]
[ WAREHOUSE = '<warehouse_location>' ]
[ "<connection_parameter>" = '<connection_parameter_value>' ]
...
);
Parameters
The following connection parameters are available for S3-compatible storage:
Supported Catalog Types
TiDB Cloud Lake supports the following Iceberg catalog types:
The Storage catalog supports the following AWS client properties:
Manage and Query Iceberg Catalogs
Use the following statements to inspect and select catalogs:
SHOW CREATE CATALOG <catalog_name>;
SHOW CATALOGS [ LIKE '<pattern>' | WHERE <expression> ];
USE CATALOG <catalog_name>;
For more information, see SHOW CREATE CATALOG and SHOW CATALOGS.
After selecting a catalog, use standard SQL to query its tables:
SELECT <select_list>
FROM [ <catalog_name>. ]<database_name>.<table_name>
[ WHERE <condition> ];
Data Type Mapping
The following table shows the supported mappings from Iceberg types to TiDB Cloud Lake types. Iceberg types not listed here are not supported.
Refresh Cached Metadata
TiDB Cloud Lake caches Iceberg catalog metadata after the first query. The metadata cache is valid for 10 minutes by default and is refreshed asynchronously.
Use the following statements when you need to refresh cached metadata immediately:
USE CATALOG <catalog_name>;
ALTER DATABASE <database_name> REFRESH CACHE;
ALTER TABLE <database_name>.<table_name> REFRESH CACHE;
TiDB Cloud Lake also supports caching table data read from Iceberg catalogs.
Write to Iceberg Tables
You can create and write Iceberg tables in a catalog that supports write operations.
Create a Table
CREATE TABLE [ <database_name>. ]<table_name> (
<column_name> <data_type> [ , ... ]
)
ENGINE = ICEBERG
[ PARTITION BY ( <column_name> [ , ... ] ) ];
The following TiDB Cloud Lake data types are supported when writing Iceberg tables:
Insert Data
Use INSERT INTO to write rows to an Iceberg table:
INSERT INTO [ <database_name>. ]<table_name>
[ ( <column_name> [ , ... ] ) ]
VALUES ( <value> [ , ... ] ) [ , ... ];
Both partitioned and non-partitioned Iceberg tables support single-row and multi-row inserts. For partitioned tables, TiDB Cloud Lake routes rows to the corresponding partitions.
Iceberg Table Functions
Use the following table functions to inspect Iceberg metadata: