Skip to content

Reading and Writing Iceberg Tables from Data Workbench

info

This feature is not enabled on accounts by default. Contact Technical Support or your Customer Success representative to enable it.

This guide explains how to read and write Iceberg tables using the Trino query engine in Data Workbench.

Overview

Data Workbench provides access to an Iceberg catalog alongside the standard Data Workbench catalog. Iceberg tables written through Data Workbench are stored in Apache Iceberg format, enabling seamless integration with external Cloud Data Warehouses (e.g., Databricks, Snowflake) via zero-copy access.

Key characteristics:

  • Iceberg tables are accessed using the iceberg catalog in Trino
  • Only the Trino engine supports reading and writing Iceberg tables (Hive is not supported)
  • Data is stored in Apache Parquet format (Iceberg table format Version 2)

Prerequisites

  1. Iceberg catalog permissions granted by an admin user (see Database-Level Access Control for Iceberg Catalog)
  2. Familiarity with running Trino queries in Data Workbench (see Data Workbench Trino Quickstart)

Table Naming Convention

Iceberg tables use a three-part fully-qualified name:

iceberg.<database>.<table>
ComponentDescriptionExample
CatalogAlways icebergiceberg
Databasetd{account_id}_{site}_exporttd10000_us01_export
TableUser-defined table namemy_table

Example fully-qualified table name: iceberg.td10000_us01_export.my_table

Supported SQL Commands

For detailed syntax, see Trino SQL Statement Syntax and Trino Iceberg Connector SQL Support.

Note: Commands not listed here are not guaranteed to work and may be unsupported or behave unexpectedly.

DDL (Data Definition Language)

CommandDescriptionRequired Permission
CREATE TABLECreate a new table with column definitionsWRITE or FULL
CREATE TABLE AS SELECTCreate a table from query resultsWRITE or FULL
ALTER TABLE SET PROPERTIESModify table properties (e.g., partitioning)FULL
ALTER TABLE EXECUTE optimizeCompact data files for better query performanceFULL
DROP TABLEDelete a table and its dataFULL
COMMENT ON TABLEAdd a comment to a tableWRITE or FULL
COMMENT ON COLUMNAdd a comment to a columnWRITE or FULL

DML (Data Manipulation Language)

CommandDescriptionRequired Permission
INSERT INTOInsert rows into a tableWRITE or FULL
UPDATEUpdate existing rows (see warning below)WRITE or FULL
DELETEDelete rows matching a condition (see warning below)WRITE or FULL
MERGEUpsert rows (insert or update based on condition, see warning below)WRITE or FULL
Warning: DELETE/UPDATE/MERGE and Databricks Compatibility

Trino writes row-level deletes using Iceberg v2 position delete files, which Databricks does not support. After running DELETE, UPDATE, or MERGE operations, you must run ALTER TABLE EXECUTE optimize to rewrite the affected data files. Until optimization is performed, the table may not be readable from Databricks.

Query

CommandDescriptionRequired Permission
SELECTQuery data with filtering, aggregation, joins, etc.READ or FULL
EXPLAINShow query execution planREAD or FULL
EXPLAIN ANALYZEShow query plan with execution statisticsREAD or FULL

Metadata

CommandDescriptionRequired Permission
SHOW SCHEMASList available databasesREAD, WRITE, or FULL
SHOW TABLESList tables in a databaseREAD, WRITE, or FULL
SHOW COLUMNSList columns of a tableREAD, WRITE, or FULL
SHOW CREATE TABLEShow the CREATE TABLE statementREAD, WRITE, or FULL
DESCRIBEShow table schemaREAD, WRITE, or FULL
ANALYZECompute table statisticsFULL

Information Schema

You can query information_schema to discover databases, tables, and columns programmatically.

TableDescription
iceberg.information_schema.schemataList all accessible databases
iceberg.information_schema.tablesList all accessible tables
iceberg.information_schema.columnsList columns of all accessible tables

Only resources belonging to your own account are visible.

Unsupported Commands

CommandReason
CREATE SCHEMADatabase creation is managed by TD
DROP SCHEMADatabase deletion is managed by TD
TRUNCATE TABLENot supported by the Iceberg connector
CREATE VIEWNot supported
CREATE MATERIALIZED VIEWNot supported

Examples

Writing Iceberg Tables

Create a Table by Copying Data from Data Workbench

Use CREATE TABLE AS SELECT (CTAS) to copy data from a Data Workbench table into an Iceberg table:

CREATE TABLE iceberg.td10000_us01_export.customer_segments
AS
SELECT * FROM my_database.customer_segments;

Create an Empty Table

CREATE TABLE iceberg.td10000_us01_export.events (
    event_id VARCHAR,
    user_id BIGINT,
    event_type VARCHAR,
    event_time TIMESTAMP(6) WITH TIME ZONE
)
WITH (
    partitioning = ARRAY['day(event_time)']
);

Insert Data

INSERT INTO iceberg.td10000_us01_export.events
SELECT event_id, user_id, event_type, event_time
FROM my_database.raw_events
WHERE td_interval(time, '-1d');

Reading Iceberg Tables

Query a Table

SELECT * FROM iceberg.td10000_us01_export.customer_segments
LIMIT 100;

List Tables in a Database

SHOW TABLES FROM iceberg.td10000_us01_export;

View Table Schema

DESCRIBE iceberg.td10000_us01_export.customer_segments;

Restrictions

Restricted Table Properties

The following table properties cannot be specified by users:

PropertyReason
locationData location is automatically assigned per account
formatAlways Parquet; cannot be changed

Unsupported Features

The following Trino Iceberg features are not supported in Data Workbench:

  • Views and materialized views
  • System procedures

Engine Limitation

  • Only the Trino engine can read and write Iceberg tables
  • The Hive engine does not support Iceberg table operations

Data Format

  • Only Apache Parquet is supported as the underlying data format

Quotas

ResourceLimit
Tables per database200,000

Further Reference