ClickHouse/docs/en/sql-reference/table-functions/iceberg.md
2023-03-21 11:17:04 -06:00

2.2 KiB

slug sidebar_label
/en/sql-reference/table-functions/iceberg Iceberg

iceberg Table Function

Provides a read-only table-like interface to Apache Iceberg tables in Amazon S3.

Syntax

iceberg(url [,aws_access_key_id, aws_secret_access_key] [,format] [,structure])

Arguments

  • url — Bucket url with the path to an existing Iceberg table in S3.
  • aws_access_key_id, aws_secret_access_key - Long-term credentials for the AWS account user. You can use these to authenticate your requests. These parameters are optional. If credentials are not specified, they are used from the ClickHouse configuration. For more information see Using S3 for Data Storage.
  • format — The format of the file. By default Parquet is used.
  • structure — Structure of the table. Format 'column1_name column1_type, column2_name column2_type, ...'.

Engine parameters can be specified using Named Collections

Returned value

A table with the specified structure for reading data in the specified Iceberg table in S3.

Example

SELECT * FROM iceberg('http://test.s3.amazonaws.com/clickhouse-bucket/test_table', 'test', 'test')

:::warning ClickHouse currently supports reading v1 (v2 support is coming soon!) of the Iceberg format via the iceberg table function and Iceberg table engine. :::

Defining a named collection

Here is an example of configuring a named collection for storing the URL and credentials:

<clickhouse>
    <named_collections>
        <iceberg_conf>
            <url>http://test.s3.amazonaws.com/clickhouse-bucket/</url>
            <access_key_id>test<access_key_id>
            <secret_access_key>test</secret_access_key>
            <format>auto</format>
            <structure>auto</structure>
        </iceberg_conf>
    </named_collections>
</clickhouse>
SELECT * FROM iceberg(iceberg_conf, filename = 'test_table')
DESCRIBE iceberg(iceberg_conf, filename = 'test_table')

See Also