Help Center/ DataArts Fabric/ Developer Guide/ Querying Data/ SQL on Iceberg/ Querying and Writing an Iceberg Table
Updated on 2025-12-19 GMT+08:00

Querying and Writing an Iceberg Table

Querying an Iceberg Table

You can query data in an Iceberg table. For specific syntax, refer to SELECT.

Note:

Only the latest complete data can currently be queried.

Example:

1
SELECT * FROM iceberg_ext order by col1;

Writing an Iceberg Table

You can add one or multiple rows of data to an Iceberg table. For specific syntax, refer to INSERT.

Notes:

  • Frequent insertion of small data may lead to small file issues. You are advised to periodically rewrite data/manifest files to maintain storage and query efficiency.
  • Currently, data files can only be written in Parquet format.

Example:

1
2
3
INSERT INTO iceberg_ext VALUES (1, 'a', 1.1234567, 100.11, '2025-03-03', '2025-03-03 16:00:00');
INSERT OVERWRITE INTO iceberg_ext VALUES (1, 'b', 1.1234567, 100.11, '2025-03-03', '2025-03-03 16:00:00');
INSERT INTO iceberg_ext (col1, col2, col3, col4, col5, col6) SELECT col1, col2, col3, col4, col5, col6 FROM iceberg_table WHERE col1 > 18;

Deleting Data from an Iceberg Table

You can delete one or more rows of data in an Iceberg table. For specific syntax, refer to DELETE.

Notes:

  • Currently, only the merge-on-read approach is supported for delete operations.
  • When performing deletions concurrently with updates or other deletions, specify partition conditions to minimize conflicts.
  • For deleting entire partitions, the operation may be optimized by marking metadata states. To check if optimization applies, use EXPLAIN DELETE and look for the keyword "Do speed up for delete". If enabled, the returned row count might exceed the actual number of deleted rows.

Example:

1
DELETE FROM iceberg_ext where a = 1;

Updating Data in Iceberg Tables

You can update one or more rows of data in an Iceberg table. For specific syntax, refer to UPDATE.

Notes:

  • Currently, only the merge-on-read approach is supported for delete operations.
  • When updating data concurrently with deletions or other updates, specify partition conditions to minimize conflicts.

Example:

1
UPDATE iceberg_ext set b = 1 where a = 1;