📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

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

ParameterRequired?Description
<catalog_name>YesName of the catalog in TiDB Cloud Lake.
TYPEYesCatalog engine. Set this value to ICEBERG.
CONNECTIONYesConnection properties for the Iceberg catalog and its storage.
TYPE inside CONNECTIONYesIceberg catalog type: rest, glue, storage, or hive.
ADDRESSDepends on catalog typeCatalog service endpoint or Hive Metastore address.
WAREHOUSEDepends on catalog typeWarehouse location used by the catalog.
<connection_parameter>Depends on catalog typeCatalog, authentication, and object storage properties.

The following connection parameters are available for S3-compatible storage:

Connection ParameterDescription
s3.endpointS3-compatible service endpoint.
s3.access-key-idS3 access key ID.
s3.secret-access-keyS3 secret access key.
s3.session-tokenSession token used with temporary credentials.
s3.regionS3 region.
client.regionRegion used by the client. This value takes precedence over s3.region.
s3.path-style-accessWhether to use path-style S3 access.
s3.sse.typeServer-side encryption type.
s3.sse.keyKMS key ID or customer-provided encryption key.
s3.sse.md5MD5 checksum for a customer-provided encryption key.
client.assume-role.arnARN of the IAM role to assume.
client.assume-role.external-idExternal ID used when assuming an IAM role.
client.assume-role.session-nameSession name used when assuming an IAM role.
s3.allow-anonymousWhether to allow anonymous access to public storage.
s3.disable-ec2-metadataWhether to disable credentials from EC2 instance metadata.
s3.disable-config-loadWhether to disable credentials and settings from local configuration sources.

Supported Catalog Types

TiDB Cloud Lake supports the following Iceberg catalog types:

Catalog TypeTYPE ValueConnection Requirements
RESTrestREST catalog address, warehouse location, and storage properties.
AWS GlueglueGlue region and authentication properties, plus S3 storage properties.
Storage (Amazon S3 Tables)storageTable bucket ARN and AWS client authentication properties.
Hive MetastorehiveHive Metastore address, warehouse location, and storage properties.

The Storage catalog supports the following AWS client properties:

Connection ParameterDescription
table_bucket_arnARN of the Amazon S3 Tables table bucket.
profile_nameAWS profile name.
region_nameAWS region.
aws_access_key_idAWS access key ID.
aws_secret_access_keyAWS secret access key.
aws_session_tokenAWS session token used with temporary credentials.

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.

Apache Iceberg™TiDB Cloud Lake
BOOLEANBOOLEAN
INTINT32
LONGINT64
DATEDATE
TIMESTAMP / TIMESTAMPZTIMESTAMP
FLOATFLOAT
DOUBLEDOUBLE
STRING / BINARYSTRING
DECIMALDECIMAL
LISTARRAY
MAPMAP
STRUCTTUPLE

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> [ , ... ] ) ];
ParameterDescription
ENGINE = ICEBERGStores the table in Iceberg format.
PARTITION BYDefines one or more partition columns.

The following TiDB Cloud Lake data types are supported when writing Iceberg tables:

TiDB Cloud Lake TypeApache Iceberg™ Type
BOOLEANBoolean
INTInt
BIGINTLong
FLOATFloat
DOUBLEDouble
STRINGString
DATEDate
TIMESTAMPTimestamp

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:

Was this page helpful?