Iceberg
Overview
This code block demonstrates how to query an Iceberg table.
CREATE FOREIGN DATA WRAPPER <wrapper_name>
HANDLER iceberg_fdw_handler
VALIDATOR iceberg_fdw_validator;
CREATE SERVER <server_name>
FOREIGN DATA WRAPPER <wrapper_name>;
CREATE FOREIGN TABLE <table_name> ()
SERVER <server_name>
OPTIONS (files '<files>');
Foreign data wrapper name. Can be any string.
Foreign server name. Can be any string.
Foreign table name. Can be any string.
The path to the Iceberg table. For instance, s3://bucket/folder
if the Iceberg table is in Amazon S3 or
/path/to/folder
if the Iceberg table is on the local file system.
Allow Moved Paths
The allow_moved_paths
option ensures that some path resolution is performed, which allows scanning Iceberg tables that are moved.
CREATE FOREIGN TABLE iceberg_table ()
SERVER iceberg_server
OPTIONS (
files 's3://bucket/folder',
allow_moved_paths 'true'
);
Linking to the Manifest File
If no version-hint.text
file is found in the Iceberg metadata, the following error will be thrown:
Error: IO Error: Cannot open file "s3://⟨bucket⟩/⟨iceberg-table-folder⟩/metadata/version-hint.text": No such file or directory
Providing the path to the <id>.metadata.json
manifest will circumvent this error.
CREATE FOREIGN TABLE iceberg_table ()
SERVER iceberg_server
OPTIONS (
files 's3://⟨bucket⟩/⟨iceberg-table-folder⟩/metadata/⟨id⟩.metadata.json',
);
Cloud Object Stores
The object stores documentation explains how to provide secrets and other credentials for Iceberg tables stored in object stores like S3.
Was this page helpful?