G.5. Reading Iceberg Tables (iceberg_scan) #
Before reading Iceberg tables, configure the Iceberg extension.
Required privileges: Superuser or the Postgres Pro AXE administrator.
For more information about access management, refer to Chapter 17.
Execute the following command on the Postgres Pro AXE server:
SELECT * FROM iceberg_scan('path', optional_parameters);
Where:
path: The path to the Iceberg table that must be read.optional_parameters: The optional parameters, specified in theparameter := valueformat.Available parameters:
allow_moved_paths: Specifies whether to read Iceberg tables that are moved to a different directory.Possible values:
truefalse
Default value:
false.metadata_compression_codec: The compression codec to use when reading metadata files.Default value:
''— no compression codec is used.snapshot_from_id: The ID of the snapshot associated with the Iceberg table.Default value:
NULL— the latest snapshot is used.snapshot_from_timestamp: The timestamp of the snapshot associated with the Iceberg table.Default value:
NULL— the latest snapshot is used.version: The version of the Iceberg table metadata file.Default value:
'?'— the version is determined automatically.version_name_format: The format string that determines how theversionvalue is converted to the Iceberg table metadata file name.Default value:
'v%s%s.metadata.json,%s%s.metadata.json'.
Postgres Pro AXE will return rows of the Iceberg table.
Example G.7. Reading an Iceberg Table
SELECT * FROM iceberg_scan('data/iceberg/table');
id | name | age
----+---------+-----
1 | Alice | 30
2 | Bob | 25
3 | Charlie | 35
You can select specific columns by assigning an alias to a procedure, such as r, and using the r[' syntax: column_name']
SELECT r['id'], r['name'] FROM iceberg_scan('data/iceberg/table') r WHERE r['age'] = 25;
id | name ----+------ 2 | Bob