iceberg-typescript
Read and write Apache Iceberg v1–v3 tables from TypeScript or JavaScript.
- Node.js, Bun, and Deno. Open a table on disk or connect to a REST, SQLite,
or PostgreSQL catalog.
- Browsers and Cloudflare Workers. Use the same package import to connect
to a remote table.
Quickstart
Use one of these runtimes. The versions below are the minimum.
- Node.js 22.15
- Bun 1.4.5
- Deno 2.9.6
Download a release archive. In your
app's directory, run the command below. Replace the example path with the path
to the downloaded file.
npm install /path/to/iceberg-typescript-0.1.0-rc.1.tgz
Save the code below as example.mjs. It creates a temporary table, adds two
rows, and reads the message from the row with ID 2.
import { mkdtemp, rm } from 'node:fs/promises';
import { join } from 'node:path';
import { defineSchema, required } from 'iceberg-typescript';
import { LocalTable } from 'iceberg-typescript/table';
const schema = defineSchema([
required('id', 'long'),
required('message', 'string'),
]);
const directory = await mkdtemp(join(import.meta.dirname, 'iceberg-example-'));
try {
const emptyTable = await LocalTable.create(directory, schema);
const table = await emptyTable.append([
{ id: 1n, message: 'started' },
{ id: 2n, message: 'finished' },
]);
for await (const row of table.scan({
columns: ['message'],
where: { op: 'gte', column: 'id', value: 2n },
})) {
console.log(row.message);
}
} finally {
await rm(directory, { recursive: true, force: true });
}
Run the example from your app's directory. You'll see finished, and the
script cleans up the temporary table when it exits.
-
Node.js with node example.mjs
-
Bun with bun example.mjs
-
Deno with the following filesystem permissions
deno run --no-lock --node-modules-dir=manual \
--allow-read="$PWD" --allow-write="$PWD" example.mjs
Use the table returned by append() to read the new rows. To keep the table,
use a permanent directory and skip the cleanup in finally. On your next run,
open the table with LocalTable.open(directory).
Connect an Iceberg catalog
A catalog helps you find tables by name. Choose your REST catalog below for a
Node.js example. Each guide shows the URL, sign-in details, and storage
settings you need.
Polaris · Nessie · Gravitino · Lakekeeper
For a managed catalog, choose AWS Glue, Google BigLake, or Fabric OneLake.
Run embedded SQL with iceberg-sql by registering an open table with
icebergSource(table). For other SQL engines, see the ClickHouse and
DuckDB guides.
Follow the web quickstarts to write from Cloudflare Workers and
read from a browser.
Documentation
- Read, write, and maintain tables. API guide · API reference ·
CLI guide
- Connect a catalog or set up storage. Configuration · Web setup
- Diagnose scan and write failures. Troubleshooting
- Share a local SQLite catalog between Bun and Node.js. Bun quickstart
- Find the formats and catalog features you can use. Feature status ·
Opt-in draft v4
- Check which local, cloud, and emulated scenarios have verification coverage.
Platform scenarios
- Validate metadata with the standalone package. iceberg-meta
Development
Run npm ci and npm test from a source checkout. To find your way around
the code, build a release, or run the Java interoperability checks, see the
development guide.
For benchmarks against Iceberg Go, Iceberg Rust, and other Parquet readers,
see benchmarks/README.md in the source checkout.
License
Apache License 2.0 · Third-party notices