Table names
table, namespace.table, and catalog.namespace.table use increasingly explicit context. Unqualified names use the session’s current catalog and namespace. Examples use readable names such as demo.tpcds.item. Replace these names with your catalog and namespace.
Create and populate a table
Prepare the write lab first. This script recreates only itsitem_sample table, copies five source rows, and reads the result. Running it again replaces that small copy.
TBLPROPERTIES ('format-version' = '2') to CREATE TABLE or CTAS when native
maintenance is needed.
For an existing table, ALTER TABLE name SET TBLPROPERTIES ('format-version' = '3')
requests a format upgrade. Format versions cannot be downgraded or unset.
Native table maintenance is enabled only for v2 tables. Reads and writes support v3.
Explicit schemas
This script recreates a small empty table before inserting two rows. SQL query types and sink types can differ: a type accepted in SELECT may still be rejected by an Iceberg writer.Alter a table
For setting, inspecting, changing, and removing saved properties, see the dedicated TBLPROPERTIES page. This example recreates a lab table, adds a nullable column, and changes a table property. Catalogs can accept a narrower set of schema changes than the SQL grammar.Temporary views
A local temporary view belongs to its session. The following view reads the original SF1 item table. Use the same session and temporary view for the next example.Drop a table
DROP removes the named table according to the catalog’s rules. IF EXISTS tolerates an absent name. This complete example creates and drops only a lab table.File sources
CSV, TSV, JSON, and Parquet can be read through a local temporary file view with USING and an OPTIONS path. A typed column list is optional where schema inference is supported. CSV options include header and delimiter; folder filtering can use pathGlobFilter. Supported local and object-store locations require configured storage access.
File views must be local temporary views; persistent/global temporary file views and IF NOT EXISTS on this form are rejected. Folder reads are bounded. The live examples use catalog-backed SF1 tables so every input already exists.
CSV options
UseUSING csv with an OPTIONS path. Set header 'true' when the first row
contains column names. Use delimiter to choose the field separator and
pathGlobFilter '*.csv' to select files. An explicit column list keeps the types
stable across input files.
Parquet options
UseUSING parquet with an OPTIONS path to read Parquet files. A
pathGlobFilter '*.parquet' filter selects matching files in a folder. These are
read options. See Iceberg write options for
compression, file sizes, and other settings used when writing Parquet.