Skip to main content

cdk-glue-iceberg-table

CI coverage npm PyPI license

AWS CDK L2 construct to create and evolve Apache Iceberg tables in the AWS Glue Data Catalog — schema and partition changes that survive CloudFormation updates, via cdk deploy.

Declare columns, partition specs, sort orders, and table properties in TypeScript or Python. Adding, renaming, dropping, or widening columns and evolving partition specs land as pull requests and apply in place through cdk deploy as a plain AWS::Glue::Table.

  • Plain CloudFormation: emits AWS::Glue::Table directly with no custom resource, Lambda, or out-of-band DDL.
  • Safe OpenTableFormatInput shape: puts schema, partitions, sort order, and properties under icebergTableInput, avoiding the two broken raw CfnTable forms (placing columns under storageDescriptor.columns, which breaks Athena after an update, or setting tableInput beside icebergTableInput, which CloudFormation rejects at creation; see Why a raw CfnTable goes wrong).
  • Synth-time checks: validates field ids, column types, and transform-to-column compatibility in TypeScript and Python (jsii) across Iceberg format versions 1, 2, and 3.

Status (November 2026): Pre-1.0 (0.x, with 1.0 planned; breaking changes bump the minor version and record upgrade notes in UPGRADING.md). Published on npm, PyPI, and Construct Hub by one maintainer; Athena queries v2 tables only, not v3. Originally proposed for @aws-cdk/aws-glue-alpha in aws/aws-cdk#37988 (closed stale in September 2026), this package is maintained independently. GitHub main may be ahead of the latest registry release (see CHANGELOG.md).

Contents

Install

npm install cdk-glue-iceberg-table      # TypeScript / JavaScript
pip install cdk-glue-iceberg-table      # Python

Peer dependencies required in your CDK app (aws-cdk-lib >= 2.273.0, because Database is imported from stable aws-cdk-lib/aws-glue, and constructs >= 10.8.1):

npm install aws-cdk-lib@^2.273.0 constructs@^10.8.1        # TypeScript / JavaScript
pip install 'aws-cdk-lib>=2.273.0' 'constructs>=10.8.1'    # Python

Both languages require Node.js 22.14 or newer (the Python package runs under it through jsii); Python requires 3.10 or newer. Upgrading from an earlier version: see UPGRADING.md (notes start at 0.12.0).

Quick start

Both examples go inside a stack's constructor in an existing CDK app. Required vs defaulted properties:

  • formatVersion is required (IcebergFormatVersion.V1, V2, or V3).
  • dataFormat defaults to IcebergDataFormat.PARQUET.
  • removalPolicy defaults to RemovalPolicy.RETAIN.

Setting identifierFieldNames prepends (PK) to each identifier column's Glue comment (Identifier fields).

TypeScript

import { Bucket } from 'aws-cdk-lib/aws-s3';
import { Database } from 'aws-cdk-lib/aws-glue';
import {
    IcebergFormatVersion,
    IcebergTable,
    IcebergType,
    IcebergPartitionTransform,
} from 'cdk-glue-iceberg-table';

const bucket = new Bucket(this, 'Warehouse');
const db = new Database(this, 'Db', { databaseName: 'analytics' });

new IcebergTable(this, 'OrdersTable', {
    database: db,
    tableName: 'orders',
    location: `s3://${bucket.bucketName}/analytics/orders/`,
    columns: [
        { name: 'order_id',    type: IcebergType.LONG,        required: true, id: 1 },
        { name: 'customer_id', type: IcebergType.LONG,        required: true, id: 2 },
        { name: 'placed_at',   type: IcebergType.TIMESTAMPTZ, required: true, id: 3 },
    ],
    partitionSpec: [
        { sourceColumn: 'placed_at',   transform: IcebergPartitionTransform.DAY,        fieldId: 1000 },
        { sourceColumn: 'customer_id', transform: IcebergPartitionTransform.bucket(16), fieldId: 1001 },
    ],
    identifierFieldNames: ['order_id'],
    formatVersion: IcebergFormatVersion.V2,
});

cdk deploy creates the Glue Data Catalog table and writes Iceberg metadata.json under the S3 prefix in location. For a full example exercising nested list, struct, and map columns, decimal, sortOrder, tableProperties, and the resulting metadata.json, see docs/full-example.md.

Python

Props are snake_case and type names match TypeScript. Pass each column and partition field as IcebergColumn and IcebergPartitionField with snake_case arguments (a plain dict keeps TypeScript keys such as sourceColumn and fieldId):

from aws_cdk.aws_s3 import Bucket
from aws_cdk.aws_glue import Database
from cdk_glue_iceberg_table import (
    IcebergColumn,
    IcebergFormatVersion,
    IcebergPartitionField,
    IcebergPartitionTransform,
    IcebergTable,
    IcebergType,
)

bucket = Bucket(self, "Warehouse")
db = Database(self, "Db", database_name="analytics")

IcebergTable(self, "OrdersTable",
    database=db,
    table_name="orders",
    location=f"s3://{bucket.bucket_name}/analytics/orders/",
    columns=[
        IcebergColumn(name="order_id", type=IcebergType.LONG, required=True, id=1),
        IcebergColumn(name="customer_id", type=IcebergType.LONG, required=True, id=2),
        IcebergColumn(name="placed_at", type=IcebergType.TIMESTAMPTZ, required=True, id=3),
    ],
    partition_spec=[
        IcebergPartitionField(source_column="placed_at", transform=IcebergPartitionTransform.DAY, field_id=1000),
        IcebergPartitionField(source_column="customer_id", transform=IcebergPartitionTransform.bucket(16), field_id=1001),
    ],
    identifier_field_names=["order_id"],
    format_version=IcebergFormatVersion.V2,
)

The field id rules

id and fieldId are Iceberg field ids. Data files store values by field id rather than column name. IcebergTable validates ids within a single declaration (Columns and field ids, Partition fields), keeps no state across deploys, and leaves cross-deploy id hygiene to you:

  1. Declare a new table's ids in creation order (columns 1, 2, 3 in order, then nested fields): Glue numbers a new table this way regardless of declared ids; if the declared ids differ, the first update Glue accepts renumbers the fields to them, causing pre-update data files to read under the wrong field. Use IcebergTable.creationOrderFieldIds(columns) (Creation order).
  2. Keep each column's id for life and retire dropped column ids: A rename keeps the id and changes name; a new column takes an id above last-column-id (how to read it). Giving a dropped column's id to a new column of the same type is accepted by Glue, causing Spark and Athena to read the dropped column's pre-drop values under the new column.
  3. Use fieldId >= 1000 and never reuse a changed or dropped partition field's id: Changing a transform or sourceColumn creates a new partition field that needs a fieldId no partition spec of the table has used. Reassigning a prior id (such as giving bucket(8) the id bucket(4) held) is accepted by Glue and readable in Athena, while Spark SELECT * fails with ValidationException: Conflicting partition fields. At creation Glue numbers partition fields sequentially from 1000 (Partition fields).

See docs/field-ids.md for worked examples and Preventing field-id reuse in team CI for an automated check.

Evolving a table

Edit columns or partitionSpec and run cdk deploy again. To add a column to the quick-start table, give it an id the table has never used:

    columns: [
        { name: 'order_id',    type: IcebergType.LONG,        required: true, id: 1 },
        { name: 'customer_id', type: IcebergType.LONG,        required: true, id: 2 },
        { name: 'placed_at',   type: IcebergType.TIMESTAMPTZ, required: true, id: 3 },
        { name: 'currency',    type: IcebergType.STRING,                      id: 4 }, // new
    ],

The construct sends the updated schema through Glue UpdateTable, which writes a new metadata.json and schema-id. Adds, renames (same id, new name), and drops apply in place through cdk deploy.

On a v2 table, promoting int to long, float to double, decimal(10, 2) to decimal(12, 2), and relaxing required: true to required: false in one update is accepted in place by Glue; field ids are preserved, and Athena reads pre-update rows and inserts widened and NULL rows. On a v3 table, Glue accepts unknown to string and date to timestamp in place. Narrowing or incompatible type changes are not observed against Glue.

Nested fields

Each struct field, list element, map key, and map value keeps its declared id across updates. Adding a nested field anywhere in the schema leaves existing ids unchanged; give each new nested field an unused id:

type: IcebergType.struct([
    { id: 10, name: 'line1', type: IcebergType.STRING },
    { id: 16, name: 'line2', type: IcebergType.STRING }, // new field, unused id
    { id: 11, name: 'city',  type: IcebergType.STRING },
]),

Change the partition spec

To change from month(placed_at) to day(placed_at), replace the entry under a fresh fieldId (rule 3):

partitionSpec: [
    // was: { sourceColumn: 'placed_at', transform: IcebergPartitionTransform.MONTH, fieldId: 1000 },
    {
        sourceColumn: 'placed_at',
        transform: IcebergPartitionTransform.DAY,
        fieldId: 1001,
    },
],

Old data files written under the month spec stay readable; new writes partition by day.

Identifiers, sort order and table properties

identifierFieldNames updates flow through cdk deploy (for tables created with identifiers before 0.11.0, check Known limitations before removing the last identifier). sortOrder updates append a new entry under the next order-id in sort-orders and point default-sort-order-id at it, keeping earlier orders in the list. Changing tableProperties alone writes new metadata while preserving current-schema-id, partition spec, and sort order.

Changes that need care

  • Changing location on an existing table: CloudFormation updates AWS::Glue::Table in place (table-uuid is preserved, and metadata.json's location and Glue's metadata_location move to the new prefix while pre-move manifests and data files remain under the old prefix). Engines with direct S3 access to both prefixes (such as Spark over S3FileIO) read pre-move rows and write new rows under the new prefix. Athena querying through Lake Formation fails both INSERT (before a new manifest list exists under the new prefix) and SELECT * with PERMISSION_DENIED (S3 403), because Lake Formation vends temporary S3 credentials scoped to the table's current location, blocking access to pre-move manifests and data files under the old prefix.

  • Dropping a column that a partition field has sourced breaks Athena: Glue accepts the update, and subsequent SELECT * and SELECT count(*) queries in Athena fail with GENERIC_INTERNAL_ERROR: Type cannot be null on pre-drop rows, whether the partition field was dropped in the same deploy or earlier. Keep source columns of historical partition fields in columns.

  • Glue ignores a V2 to V3 formatVersion change: The table stays format 2 while properties.format-version becomes 3. Keep formatVersion at the table's actual format version.

  • Engine-side ALTER TABLE drift:

    • After Athena ALTER TABLE ... ADD COLUMNS (w string) adds w under id 3 and writes a row with w, a deploy with the declaration unchanged leaves Glue VersionId and metadata_location unchanged; a deploy that updates a table property without declaring w removes w from the current schema (SELECT * omits w); declaring w under id 3 adds no schema and reads w; declaring w under id 4 is accepted and reads w as NULL in that row.
    • After Spark upgrades a v2 table to v3 via SET TBLPROPERTIES ('format-version' = '3'), update formatVersion to IcebergFormatVersion.V3 so properties.format-version matches the format 3 table. Outcomes after other engine-side ALTER TABLE statements are not observed.
  • A rolled-back deploy leaves its schema in the table's history: When a column addition succeeds on the table before another stack resource fails, UPDATE_ROLLBACK_COMPLETE restores current-schema-id, while the new schema stays in schemas and last-column-id stays bumped. Treat ids from a rolled-back deploy as used.

Changes that replace or remove the table

Changing tableName, database, or catalogId replaces the table (Name, DatabaseName, and CatalogId require replacement in AWS::Glue::Table). removalPolicy (default RemovalPolicy.RETAIN) sets both DeletionPolicy and UpdateReplacePolicy: under RETAIN, CloudFormation leaves the old catalog entry in Glue outside the stack; under DESTROY, CloudFormation deletes the old catalog entry. Glue creates the replacement as a new table carrying nothing over from the old one.

When a deploy under RemovalPolicy.DESTROY changes tableName while keeping the same location, Glue creates the replacement with a new table-uuid and a 00000- metadata file at that location, Athena SELECT * returns no rows, and objects written by the old table stay under location beside that file. What a same-location replacement under RemovalPolicy.RETAIN leaves at the old location is not observed.

Give a replacement table its own location: IcebergTable never deletes S3 objects, and whether Athena VACUUM on a replacement sharing an old location treats the old table's files as orphans past vacuum_max_snapshot_age_seconds is not observed.

Is this the right tool

How it compares

Approach Declarative IaC (in the PR) In-place schema + partition evolution Keeps out the two hand-written shapes that go wrong Typed API + synth-time validation
Raw CfnTable (L1) Yes Only if you hand-write the OpenTableFormatInput shape Yours to avoid No
CDK custom resource (Lambda + Glue SDK) Custom resource to maintain Diff logic is yours to write Your code's responsibility No
Spark SQL or Athena SQL DDL at job runtime Imperative, outside CloudFormation Outside CloudFormation n/a No
cdk-glue-iceberg-table Yes Via cdk deploy Avoids both by construction; field-id reuse is not checked Yes

Why a raw CfnTable goes wrong

AWS documents Iceberg tables on AWS::Glue::Table with OpenTableFormatInput.IcebergInput (AWS Big Data blog, aws/aws-cdk#29660). The two shapes below break or fail.

Schema under storageDescriptor.columns

Glue creates the table below with parameter table_type ICEBERG, and Athena SELECT * initially returns its header. After an update that adds a column, the table has no Glue parameters and Athena SELECT * and SELECT count(*) fail with HIVE_UNSUPPORTED_FORMAT.

new CfnTable(this, 'OrdersBad', {
    catalogId: this.account,
    databaseName: 'analytics',
    tableInput: {
        name: 'orders',
        tableType: 'EXTERNAL_TABLE',
        storageDescriptor: {
            location: 's3://.../orders/',
            columns: [/* ... */],
        },
    },
    openTableFormatInput: {
        icebergInput: {
            metadataOperation: 'CREATE',
            version: '2',
        },
    },
});

IcebergTable always emits schema, partitions, sort order, and properties under openTableFormatInput.icebergInput.icebergTableInput.

tableInput beside icebergTableInput

Declaring tableInput (even holding only name) beside openTableFormatInput.icebergInput.icebergTableInput fails at creation with Table metadata is expected only via TableInput or via IcebergTableInput inside OpenTableFormatInput. IcebergTable omits tableInput and stores comment in icebergTableInput.properties['comment'].

What the construct rests on

IcebergTable relies on undocumented AWS Glue behaviors verified on v2 and v3 tables against Spark and Athena; see docs/glue-behaviours.md for the observed list.

Granting access

const table = new IcebergTable(this, 'Orders', {
    // ...
    encryptionKey: bucketKey,        // KMS key encrypting the table's S3 bucket
});
table.grantRead(role);
table.grantWrite(role);
table.grantReadWrite(role, {
    catalogEncryptionKey: catalogKey, // Glue Data Catalog SSE-KMS key
    lakeFormationDataAccess: true,    // Athena / Lake Formation registered locations
});

Each method emits these IAM statements and no others:

Statement grantRead grantWrite grantReadWrite Resource
Glue glue:BatchGetPartition, glue:GetDatabase, glue:GetPartition, glue:GetPartitions, glue:GetTable, glue:GetTables, glue:GetTableVersion, glue:GetTableVersions glue:BatchCreatePartition, glue:BatchDeletePartition, glue:CreatePartition, glue:DeletePartition, glue:UpdatePartition, glue:UpdateTable both lists catalog, database, and table ARNs in the stack account or catalogId
S3 list s3:ListBucket none s3:ListBucket bucket ARN with condition StringLike s3:prefix = <prefix>* or <prefix>
S3 bucket s3:GetBucketLocation s3:ListBucketMultipartUploads both bucket ARN
S3 objects s3:GetObject s3:PutObject, s3:DeleteObject, s3:AbortMultipartUpload, s3:ListMultipartUploadParts both lists <bucket>/<prefix>*
Table key (encryptionKey) kms:Decrypt kms:Decrypt, kms:GenerateDataKey kms:Decrypt, kms:GenerateDataKey the key
Catalog key (catalogEncryptionKey) kms:Decrypt kms:Decrypt, kms:Encrypt, kms:GenerateDataKey kms:Decrypt, kms:Encrypt, kms:GenerateDataKey the key
Lake Formation (lakeFormationDataAccess: true) lakeformation:GetDataAccess lakeformation:GetDataAccess lakeformation:GetDataAccess *

KMS grants apply to the whole key (IKey.grant adds no encryption-context condition), so a shared bucket or catalog key grants access for everything it encrypts. lakeformation:GetDataAccess uses * because Lake Formation supports no resource ARN for that action; the construct issues it only when lakeFormationDataAccess: true is passed, allowing the principal to call GetDataAccess for tables authorized by Lake Formation.

Lake Formation permissions (AWS::LakeFormation::Permissions) are declared separately:

import { CfnPermissions } from 'aws-cdk-lib/aws-lakeformation';

new CfnPermissions(this, 'OrdersReader', {
    dataLakePrincipal: { dataLakePrincipalIdentifier: role.roleArn },
    resource: {
        tableResource: {
            catalogId: this.account,
            databaseName: table.database.databaseName,
            name: table.tableName,
        },
    },
    permissions: ['SELECT', 'DESCRIBE'], // add INSERT, DELETE, ALTER for writers
});

In Python, use encryption_key, lake_formation_data_access, and catalog_encryption_key.

CloudFormation deploying-role permissions

The IAM role deploying a stack with IcebergTable (in CDK, the CloudFormation execution role passed via iam:PassRole on bootstrap roles) needs Glue database and table permissions (CreateTable, UpdateTable, DeleteTable, GetTable, GetDatabase), S3 read/write on the table location prefix (Glue writes metadata.json there on create and update) plus KMS permissions on any bucket or catalog encryption keys, and Lake Formation admin or table/data-location permissions if Lake Formation governs the location. See docs/integ-test-setup.md for the complete IAM and Lake Formation setup used by the repository's integration stacks.

Reference

Format version 3

Set formatVersion: IcebergFormatVersion.V3 to create a v3 table. The six v3 types below are accepted only on V3 tables at any nesting depth; cdk synth rejects them on V1 or V2 tables.

import {
    IcebergEdgeAlgorithm,
    IcebergFormatVersion,
    IcebergTable,
    IcebergType,
} from 'cdk-glue-iceberg-table';

new IcebergTable(this, 'Events', {
    database: db,
    tableName: 'events',
    location: `s3://${bucket.bucketName}/analytics/events/`,
    columns: [
        { name: 'occurred_at', type: IcebergType.TIMESTAMP_NS, id: 1 },
        { name: 'payload',     type: IcebergType.VARIANT,      id: 2 },
        {
            name: 'origin',
            type: IcebergType.geography('OGC:CRS84', IcebergEdgeAlgorithm.SPHERICAL),
            id: 3,
        },
    ],
    formatVersion: IcebergFormatVersion.V3,
});

The same table in Python:

from cdk_glue_iceberg_table import (
    IcebergColumn,
    IcebergEdgeAlgorithm,
    IcebergFormatVersion,
    IcebergTable,
    IcebergType,
)

IcebergTable(self, "Events",
    database=db,
    table_name="events",
    location=f"s3://{bucket.bucket_name}/analytics/events/",
    columns=[
        IcebergColumn(name="occurred_at", type=IcebergType.TIMESTAMP_NS, id=1),
        IcebergColumn(name="payload", type=IcebergType.VARIANT, id=2),
        IcebergColumn(
            name="origin",
            type=IcebergType.geography("OGC:CRS84", IcebergEdgeAlgorithm.SPHERICAL),
            id=3,
        ),
    ],
    format_version=IcebergFormatVersion.V3,
)
Type Factory Rendered string Partition and identifier rules
unknown IcebergType.UNKNOWN unknown Optional only (column, list element, or map value; never a map key). Partition source only with void. Not an identifier field.
timestamp_ns IcebergType.TIMESTAMP_NS timestamp_ns identity, year, month, day, hour, bucket(N), void; not truncate(W). Allowed as an identifier field.
timestamptz_ns IcebergType.TIMESTAMPTZ_NS timestamptz_ns Same as timestamp_ns.
variant IcebergType.VARIANT variant Never a partition or sort source, void included. Not an identifier field.
geometry IcebergType.geometry(crs?) geometry, or geometry(<crs>) Partition source only with void. Not an identifier field.
geography IcebergType.geography(crs?, algorithm?) geography, geography(<crs>), or geography(<crs>, <algorithm>) Same as geometry. Setting algorithm without crs spells out OGC:CRS84.

Geometry and geography crs values must be non-empty identifiers (such as OGC:CRS84 or EPSG:3857) with no whitespace, parentheses, braces, or commas.

Engine v3 tables Notes
Spark 4.1.1 + Iceberg 1.11.0 Yes Supports deletion vectors, row lineage, variant, and unknown; cannot open timestamp_ns, timestamptz_ns, geometry, or geography (Known limitations).
AWS Glue 6.0 Documented AWS Glue release notes list Iceberg v3 (VARIANT, deletion vectors, row lineage, nanosecond timestamps, geo types); shares the Spark/Iceberg versions above (scripts/spark/spark-env.sh), while the managed Glue job runtime itself is not exercised here.
Amazon EMR Spark 8.1.0 Documented EMR Spark 8.1.0 release notes list Iceberg v3 support; not exercised here.
Athena SQL No Athena Iceberg documentation states Athena operates only on Iceberg v2 tables.

Columns and field ids

Every top-level column takes an id, every struct field takes an id, every list takes elementId, and every map takes keyId and valueId. All ids in a schema must be distinct integers from 1 to 2147483447 (Integer.MAX_VALUE - 200, the Iceberg reserved field ids ceiling).

Creation order

Glue numbers a new table's top-level columns first in declaration order, then each column's nested fields in turn (list element; map key, map value, key's nested fields, value's nested fields; struct fields, then their nested fields). IcebergTable.creationOrderFieldIds(columns) returns this path-to-id map regardless of the ids in columns:

const columns = [
    { name: 'id', type: IcebergType.LONG, required: true, id: 1 },
    { name: 'tags', type: IcebergType.list({ element: IcebergType.STRING, elementId: 4 }), id: 2 },
    {
        name: 'attrs',
        type: IcebergType.map({ key: IcebergType.STRING, keyId: 5, value: IcebergType.STRING, valueId: 6 }),
        id: 3,
    },
];
IcebergTable.creationOrderFieldIds(columns);
// { id: 1, tags: 2, attrs: 3, 'tags.element': 4, 'attrs.key': 5, 'attrs.value': 6 }

Partition fields

Each partition field declares a fieldId of 1000 or above (matching the Iceberg spec reference numbering) and an IcebergPartitionTransform. cdk synth validates fieldId >= 1000 and transform-to-column compatibility. Number a new table's partition fields 1000, 1001, and up in partitionSpec order: Glue assigns those ids at creation and ignores declared ones, whereas fields added in later updates keep their declared fieldId.

Identifier fields

identifierFieldNames lists columns that together identify a row and renders as schema.identifierFieldIds. cdk synth enforces required: true on every identifier column and rejects types float, double, list, map, struct, unknown, variant, geometry, and geography.

The construct prepends (PK) to each identifier column's doc ((PK) alone when doc is omitted), so user-supplied doc strings cannot start with (PK) . Because Glue's UpdateTable reuses an earlier schema whose fields (including doc) match the request, the marker ensures every identifier change produces a distinct schema change.

Table properties

tableProperties entries are passed to Glue as given, except format-version and write.format.default, which are populated from formatVersion and dataFormat and must agree if repeated in tableProperties. Set the table description via either comment or tableProperties['comment'], not both. For v2 or v3 merge-on-read DML, set write.delete.mode, write.update.mode, and write.merge.mode to 'merge-on-read' in tableProperties.

Adopting an existing table or migrating to raw CfnTable

Use IcebergTable.fromIcebergTableAttributes to reference an existing table for grants (grantRead, grantWrite, grantReadWrite) without managing its schema or properties in CloudFormation:

const existing = IcebergTable.fromIcebergTableAttributes(this, 'Orders', {
    database: db,
    tableName: 'orders',
    location: 's3://my-bucket/analytics/orders/',
    encryptionKey: bucketKey, // optional
    catalogId: '111122223333', // optional
});
existing.grantRead(role);

To migrate an existing IcebergTable off this construct onto a raw CfnTable without replacing the Glue table, use the table.resource escape hatch (the underlying CfnTable child with construct id 'Resource', also exposed as table.node.defaultChild). Because IcebergTable nests its CfnTable under child id 'Resource', capture its CloudFormation logical ID from the synthesized template (or stack.getLogicalId(table.resource)) before removing IcebergTable, declare a CfnTable with the matching openTableFormatInput.icebergInput properties and applyRemovalPolicy(...), and pass that logical ID to raw.overrideLogicalId(logicalId):

import { RemovalPolicy } from 'aws-cdk-lib';
import { CfnTable } from 'aws-cdk-lib/aws-glue';

// Capture `logicalId` from the existing stack (`stack.getLogicalId(table.resource)`) before replacing:
const raw = new CfnTable(this, 'OrdersTable', {
    catalogId: this.account,
    databaseName: db.databaseName,
    name: 'orders',
    openTableFormatInput: { /* matching icebergInput shape */ },
});
raw.applyRemovalPolicy(RemovalPolicy.RETAIN);
raw.overrideLogicalId(logicalId);

With matching properties, removal policy, and logical ID, the synthesized AWS::Glue::Table resource is identical to what IcebergTable emits, so cdk deploy leaves the Glue table untouched.

Preventing field-id reuse in team CI

Because IcebergTable checks ids within one declaration only, teams can prevent accidental id reuse in CI by comparing each PR's synthesized AWS::Glue::Table template (Properties.OpenTableFormatInput.IcebergInput.IcebergTableInput.Schema.Fields and PartitionSpec.Fields) against the live table's metadata.json (last-column-id, historical schemas, last-partition-id, and partition-specs, read from the S3 URI in Glue's Table.Parameters.metadata_location): fail CI if any newly added column or nested field reuses an id <= last-column-id or an id previously bound to a different field path/name in schemas, or if a changed partition field reuses an existing field-id. See docs/field-ids.md for the exact aws glue get-table / aws s3 cp lookup commands.

Catalog account and tokenized table names

catalogId (catalog_id in Python) on IcebergTable and IcebergTableAttributes sets the target Glue Data Catalog account (12 digits if literal, or a CDK token). When omitted, the stack's account is used; when set, CatalogId, tableArn, and all grant database/table/catalog ARNs use that account (the database must already exist in that catalog, and cross-account catalog/Lake Formation/IAM policies remain yours to configure).

tableName accepts a lowercase [a-z0-9_]+ literal or a CDK token (such as CfnParameter or cross-stack reference). Tokens are not validated at synth time; avoid resolving tableName to *, which would widen grants across every table in the database.

Exported types

All symbols exported by cdk-glue-iceberg-table (in Python, cdk_glue_iceberg_table):

  • IcebergTable: the L2 construct, exposing tableArn, tableName, database, location, encryptionKey, dataFormat, formatVersion, resource (the underlying CfnTable child 'Resource'), grantRead / grantWrite / grantReadWrite, fromIcebergTableAttributes(...), and creationOrderFieldIds(columns) (creation_order_field_ids in Python; names containing . or ``` are backquoted).
  • IIcebergTable: public interface implemented by IcebergTable and tables returned by fromIcebergTableAttributes.
  • IcebergTableProps: constructor properties interface for IcebergTable.
  • IcebergTableAttributes: attributes interface for IcebergTable.fromIcebergTableAttributes.
  • IcebergTableGrantOptions: options interface for grant methods (lakeFormationDataAccess, catalogEncryptionKey).
  • IcebergColumn: top-level column definition (name, type, id, optional required, doc).
  • IcebergPartitionField: partition spec entry (sourceColumn, transform, fieldId, optional name).
  • IcebergSortField: write-order entry (sourceColumn, optional transform, direction, nullOrder).
  • IcebergType: type constants and factories (BOOLEAN, INT, LONG, FLOAT, DOUBLE, DATE, TIME, TIMESTAMP, TIMESTAMPTZ, STRING, UUID, BINARY, UNKNOWN, TIMESTAMP_NS, TIMESTAMPTZ_NS, VARIANT, decimal, fixed, list, map, struct, geometry, geography) with private constructor and kind: IcebergTypeKind.
  • IcebergTypeKind: enum discriminator for IcebergType (for example, type.kind === IcebergTypeKind.DECIMAL).
  • IcebergListDefinition, IcebergMapDefinition, IcebergStructFieldDefinition: nested-type definitions carrying element, key, value, and struct field ids.
  • IcebergEdgeAlgorithm: geography edge-interpolation algorithm enum (SPHERICAL, VINCENTY, THOMAS, ANDOYER, KARNEY).
  • IcebergPartitionTransform: transform constants and factories (IDENTITY, YEAR, MONTH, DAY, HOUR, VOID, bucket(N), truncate(W)) with private constructor, kind: IcebergPartitionTransformKind, and toTransformString().
  • IcebergPartitionTransformKind: enum discriminator for IcebergPartitionTransform (for example, transform.kind === IcebergPartitionTransformKind.BUCKET).
  • IcebergDataFormat: data-file format enum (PARQUET, ORC, AVRO; defaults to PARQUET).
  • IcebergFormatVersion: Iceberg format version enum (V1, V2, V3; required on IcebergTable).
  • IcebergSortDirection: sort direction enum (ASC, DESC).
  • IcebergNullOrder: null-ordering enum (NULLS_FIRST, NULLS_LAST).

Known limitations

  • Creation-time numbering: Glue ignores declared column and partition ids on CREATE and numbers columns in creation order and partition fields from 1000 (Creation order, Partition fields).
  • Stateless field-id validation: IcebergTable checks ids within one declaration only and cannot detect cross-deploy id reuse (The field id rules).
  • Merge-on-read on v1: write.{delete,update,merge}.mode = merge-on-read is not rejected at synth on IcebergFormatVersion.V1; set it only on v2 or v3 tables.
  • Mixed CDK and engine partition evolution: check last-partition-id in metadata.json before running engine-side ALTER TABLE ... ADD PARTITION FIELD after CDK partition updates.
  • Pre-0.11.0 identifier removal: tables created with identifiers before 0.11.0 lack (PK) markers in their earliest schema, so removing the last identifier without changing another column's doc restores the old schema with ids.
  • Update mechanism: every non-replacing deploy emits metadataOperation: 'CREATE' (the only value CloudFormation's IcebergInput accepts), which CloudFormation passes through Glue's UpdateTable.
  • Column defaults and Athena DDL-only clauses: Iceberg v3 initial-default / write-default and Hive/Athena-only clauses (ALTER TABLE ... SET LOCATION, bucketed_by) are not exposed by AWS::Glue::Table (use IcebergPartitionTransform.bucket(N)).
  • Spark v3 type support: Spark and Iceberg at the versions listed under Format version 3 lack TypeToSparkType conversion for timestamp_ns, timestamptz_ns, geometry, and geography (Cannot convert unsupported type to Spark), so tables with those columns are catalog-only in those runtimes.

Contributing

The package is developed in the ksco92/arceus monorepo alongside a CDK demo and integration suite. Build/test instructions, CI and release gates, and the demo stacks live in CONTRIBUTING.md.

License

MIT.

Metadata

Release files for cdk-glue-iceberg-table 0.23.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdk-glue-iceberg-table 0.23.0
File Size Uploaded Provenance Actions
cdk_glue_iceberg_table-0.23.0.tar.gz 179.8 kB With provenance Details for cdk_glue_iceberg_table-0.23.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cdk-glue-iceberg-table 0.23.0
File Interpreter ABI Platform Actions
cdk_glue_iceberg_table-0.23.0-py3-none-any.whl Python 3 none any Details for cdk_glue_iceberg_table-0.23.0-py3-none-any.whl

Total release size: 334.5 kB

Release files / cdk_glue_iceberg_table-0.23.0.tar.gz

Download URL cdk_glue_iceberg_table-0.23.0.tar.gz
Size 179.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fd7b8131474edefa3b0697fefaee0586a8b2e39be9b51212f88f8fa015920ed7
BLAKE2b-256 checksum
How to use checksums
ef24275acfef4c80bf5861b0e531814e2f70cdfbe6c8de444212f7edd90de6cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / cdk_glue_iceberg_table-0.23.0-py3-none-any.whl

Download URL cdk_glue_iceberg_table-0.23.0-py3-none-any.whl
Size 154.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01cc201a39c7fb42a6b5418fc215c06aab81c468ed1661387578e7bf14b3d469
BLAKE2b-256 checksum
How to use checksums
ce62af28435c7170508ef4284610dc0718bd491a880d41571c9903d32867f5dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for cdk-glue-iceberg-table 0.23.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cdk_glue_iceberg_table-0.23.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.23.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page