cdk-glue-iceberg-table
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::Tabledirectly with no custom resource, Lambda, or out-of-band DDL. - Safe
OpenTableFormatInputshape: puts schema, partitions, sort order, and properties undericebergTableInput, avoiding the two broken rawCfnTableforms (placing columns understorageDescriptor.columns, which breaks Athena after an update, or settingtableInputbesideicebergTableInput, 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 within one declaration in TypeScript and Python (jsii) across Iceberg format versions 1, 2, and 3.
Status (November 2026): Stable (1.x, semver; breaking changes bump the major version and record upgrade notes in UPGRADING.md). Published on npm, PyPI, and Construct Hub by one maintainer, with a zero-replacement plain-CfnTable eject hatch. Targeted at new tables (cdk import of existing tables is untested; use fromIcebergTableAttributes for grants). 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:
databaseaccepts anyIDatabase, including a newDatabaseor an existing Glue database imported viaDatabase.fromDatabaseArn(...).formatVersionis required (IcebergFormatVersion.V1,V2, orV3).dataFormatdefaults toIcebergDataFormat.PARQUET.removalPolicydefaults toRemovalPolicy.RETAIN.
(Setting identifierFieldNames prepends (PK) to each identifier column's Glue comment; see 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:
- 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). - Keep each column's id for life and retire dropped column ids: A rename keeps the
idand changesname; a new column takes an id abovelast-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. - Use
fieldId >= 1000and never reuse a changed or dropped partition field's id: Changing a transform orsourceColumncreates a new partition field that needs afieldIdno partition spec of the table has used. Reassigning a prior id (such as givingbucket(8)the idbucket(4)held) is accepted by Glue and readable in Athena, while SparkSELECT *fails withValidationException: Conflicting partition fields. At creation Glue numbers partition fields sequentially from 1000 (Partition fields).
See docs/field-ids.md for worked examples.
Preventing field-id reuse in team CI
Because IcebergTable checks ids within one declaration only, run the bundled cdk-glue-iceberg-check-field-ids CLI in CI against each PR's synthesized template and the live table's metadata.json to fail before deploy on field-id reuse or stale partition counters:
aws s3 cp "$(aws glue get-table --database-name analytics --name orders \
--query 'Table.Parameters.metadata_location' --output text)" metadata.json
npx --no -- cdk-glue-iceberg-check-field-ids cdk.out/MyStack.template.json metadata.json --table orders
Python projects can run it via npx --package cdk-glue-iceberg-table@<version> -- cdk-glue-iceberg-check-field-ids ... with <version> pinned to the installed release (Node.js is already required by jsii). See docs/field-ids.md#check-in-ci for the full check list, --table behavior, and exit codes.
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 at synth time (check in CI with the bundled CLI) | Yes |
- No native Iceberg L2 in AWS CDK: neither
aws-cdk-lib/aws-gluenor@aws-cdk/aws-glue-alphaprovides an Iceberg table L2 (aws/aws-cdk#37988 closed stale).
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
Every non-replacing deploy emits metadataOperation: 'CREATE' (the only value CloudFormation's IcebergInput accepts), which CloudFormation passes through Glue's UpdateTable to update the Iceberg table metadata in place. That update mechanism and its edge cases rest on undocumented AWS Glue behaviors verified by .github/workflows/integ-test.yml, which runs weekly against main and before merge on every PR touching the construct, demo stacks, or suites (see docs/glue-behaviours.md for the observed list). The suite tests IcebergFormatVersion.V1 create, update, and Spark reads/writes, v2 tables against Glue, Athena, and Spark (including AWS::Glue::TableOptimizer compaction and retention attachment and cdk deploy update survival; CI does not wait for asynchronous background optimizer runs), and v3 tables against Glue and Spark. When attaching CfnTableOptimizer in the same stack, grant table access with table.grantReadWrite(optimizerRole, { lakeFormationDataAccess: true, catalogEncryptionKey }) (setting encryptionKey on the table when the S3 bucket is KMS-encrypted, plus Lake Formation permissions where Lake Formation governs the table; Glue validates lakeformation:GetDataAccess and KMS access at creation) and add explicit dependencies (optimizer.node.addDependency(table) and the role/permissions) so CloudFormation creates the table and grants before the optimizer.
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 have not been tested 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 day(placed_at) to month(placed_at) on the quick-start orders table, keep bucket(16) at fieldId 1001 and replace the placed_at entry under fresh fieldId 1002 (rule 3):
partitionSpec: [
// was: { sourceColumn: 'placed_at', transform: IcebergPartitionTransform.DAY, fieldId: 1000 },
{ sourceColumn: 'placed_at', transform: IcebergPartitionTransform.MONTH, fieldId: 1002 },
{ sourceColumn: 'customer_id', transform: IcebergPartitionTransform.bucket(16), fieldId: 1001 },
],
Old data files written under the day spec stay readable; new writes partition by month.
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
locationon an existing table: CloudFormation updatesAWS::Glue::Tablein place (table-uuidis preserved, andmetadata.json'slocationand Glue'smetadata_locationmove 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 overS3FileIO) read pre-move rows and write new rows under the new prefix. Athena querying through Lake Formation fails bothINSERT(before a new manifest list exists under the new prefix) andSELECT *withPERMISSION_DENIED(S3 403), because Lake Formation vends temporary S3 credentials scoped to the table's currentlocation, 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 *andSELECT count(*)queries in Athena fail withGENERIC_INTERNAL_ERROR: Type cannot be nullon pre-drop rows, whether the partition field was dropped in the same deploy or earlier. Keep source columns of historical partition fields incolumns. -
Glue ignores a V2 to V3
formatVersionchange: The table stays format 2 whileproperties.format-versionbecomes3. KeepformatVersionat the table's actual format version. -
Engine-side
ALTER TABLEdrift:-
After Athena
ALTER TABLE ... ADD COLUMNS (w string)addswunder id 3 and writes a row withw:- A deploy with the declaration unchanged leaves Glue
VersionIdandmetadata_locationunchanged. - A deploy that updates a table property without declaring
wremoveswfrom the current schema (SELECT *omitsw). - A deploy declaring
wunder id 3 adds no schema and readsw. - A deploy declaring
wunder id 4 is accepted and readswasNULLin that row.
- A deploy with the declaration unchanged leaves Glue
-
After Spark upgrades a v2 table to v3 via
SET TBLPROPERTIES ('format-version' = '3'), updateformatVersiontoIcebergFormatVersion.V3soproperties.format-versionmatches the format 3 table. Outcomes after other engine-sideALTER TABLEstatements have not been tested.
-
-
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_COMPLETErestorescurrent-schema-id, while the new schema stays inschemasandlast-column-idstays 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 has not been tested.
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 has not been tested.
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';
const permissions = 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
});
// `table.tableName` is a literal string and creates no implicit CloudFormation dependency,
// so declare the dependency explicitly to avoid racing Glue table creation on first deploy:
permissions.node.addDependency(table);
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
IcebergTableProps
Constructor properties on IcebergTable (in Python, snake_case keyword arguments):
| Property | Type | Required | Default / notes |
|---|---|---|---|
database |
IDatabase |
Yes | Any IDatabase, including a new Database or one imported via Database.fromDatabaseArn(...) |
tableName |
string |
Yes | [a-z0-9_]+ literal, or a CDK token |
columns |
IcebergColumn[] |
Yes | Non-empty; column.required defaults to false |
location |
string |
Yes | S3 URI starting with s3:// (trailing / appended if omitted; tokenized location rules) |
formatVersion |
IcebergFormatVersion |
Yes | V1, V2, or V3 |
catalogId |
string |
No | Stack's account; 12-digit literal or CDK token |
encryptionKey |
IKey |
No | None; KMS key encrypting the table's bucket for grants |
partitionSpec |
IcebergPartitionField[] |
No | None; fieldId >= 1000, name defaults to <sourceColumn> (IDENTITY) or <sourceColumn>_<transform> |
sortOrder |
IcebergSortField[] |
No | None (non-empty if set); field defaults: transform IDENTITY, direction ASC, nullOrder NULLS_LAST |
identifierFieldNames |
string[] |
No | None; each named column must have required: true (prepends (PK) to doc) |
dataFormat |
IcebergDataFormat |
No | IcebergDataFormat.PARQUET (PARQUET, ORC, AVRO) |
tableProperties |
{ [key: string]: string } |
No | None; format-version and write.format.default are populated automatically |
comment |
string |
No | None; published under properties['comment'] (mutually exclusive with tableProperties['comment']) |
removalPolicy |
RemovalPolicy |
No | RemovalPolicy.RETAIN (sets DeletionPolicy and UpdateReplacePolicy) |
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.
Format version 3
Set formatVersion: IcebergFormatVersion.V3 to enable the six v3 column types at any nesting depth (UNKNOWN, TIMESTAMP_NS, TIMESTAMPTZ_NS, VARIANT, geometry(crs?), and geography(crs?, algorithm?) with IcebergEdgeAlgorithm); cdk synth rejects them on V1 and V2 tables.
Spark supports deletion vectors, row lineage, variant, and unknown, while four v3 types are catalog-only (Known limitations).
See docs/format-version-3.md for TypeScript and Python examples, per-type partition and identifier rules, crs validation, and the engine compatibility table.
Referencing an existing table or migrating to raw CfnTable
Use IcebergTable.fromIcebergTableAttributes for read-only IAM grant references (grantRead, grantWrite, grantReadWrite) to an existing table without managing or mutating its schema or properties in CloudFormation (cdk import of an existing Glue Iceberg table into IcebergTable management has not been tested):
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, run cdk synth before removing IcebergTable and copy both the resource's CloudFormation logical ID (also returned by stack.getLogicalId(table.resource), where table.resource is the underlying CfnTable child with construct id 'Resource', also exposed as table.node.defaultChild) and its synthesized OpenTableFormatInput shape directly from the synthesized template. Declare new CfnTable(...) with those openTableFormatInput properties (mapping the template's PascalCase keys such as IcebergInput and IcebergTableInput to camelCase CfnTable props), call applyRemovalPolicy(...), and pass the captured logical ID to raw.overrideLogicalId(logicalId):
import { RemovalPolicy } from 'aws-cdk-lib';
import { CfnTable } from 'aws-cdk-lib/aws-glue';
// `logicalId` from `cdk synth` (or `stack.getLogicalId(table.resource)`):
const raw = new CfnTable(this, 'OrdersTable', {
catalogId: this.account,
databaseName: db.databaseName,
name: 'orders',
openTableFormatInput: { /* copied from synthesized Properties.OpenTableFormatInput */ },
});
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.
Catalog account, tokenized table names, and tokenized locations
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.
location (on both IcebergTable and IcebergTableAttributes) must start with a literal s3:// prefix and separate the bucket from any key prefix with a literal / (for example s3://${bucket.bucketName}/analytics/orders/). A pure token without s3:// is rejected at synth time, and a single token combining bucket and prefix without a literal / puts the whole token into the bucket ARN with an empty prefix for grants.
Exported types
All symbols exported by cdk-glue-iceberg-table (in Python, cdk_glue_iceberg_table):
IcebergTable: the L2 construct, exposingtableArn,tableName,database,location,encryptionKey,dataFormat,formatVersion,resource(the underlyingCfnTablechild'Resource'),grantRead/grantWrite/grantReadWrite,fromIcebergTableAttributes(...), andcreationOrderFieldIds(columns)(creation_order_field_idsin Python; names containing.or ``` are backquoted).IIcebergTable: public interface (extendingIResource) implemented byIcebergTableand tables returned byfromIcebergTableAttributes.IcebergTableProps: constructor properties interface forIcebergTable.IcebergTableAttributes: attributes interface forIcebergTable.fromIcebergTableAttributes.IcebergTableGrantOptions: options interface for grant methods (lakeFormationDataAccess,catalogEncryptionKey).IcebergColumn: top-level column definition (name,type,id, optionalrequired,doc).IcebergPartitionField: partition spec entry (sourceColumn,transform,fieldId, optionalname).IcebergSortField: write-order entry (sourceColumn, optionaltransform,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 andkind: IcebergTypeKind.IcebergTypeKind: enum discriminator forIcebergType(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, andtoTransformString().IcebergPartitionTransformKind: enum discriminator forIcebergPartitionTransform(for example,transform.kind === IcebergPartitionTransformKind.BUCKET).IcebergDataFormat: data-file format enum (PARQUET,ORC,AVRO; defaults toPARQUET).IcebergFormatVersion: Iceberg format version enum (V1,V2,V3; required onIcebergTable).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
CREATEand numbers columns in creation order and partition fields from1000(Creation order, Partition fields). - Stateless field-id validation:
IcebergTablechecks 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-readis not rejected at synth onIcebergFormatVersion.V1; set it only on v2 or v3 tables. - Mixed CDK and engine partition evolution: check
last-partition-idinmetadata.jsonbefore running engine-sideALTER TABLE ... ADD PARTITION FIELDafter CDK partition updates; iflast-partition-idis below the highest declared partitionfieldId, an engine-sideADD PARTITION FIELDcan collide with an existing partition spec entry. - 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'sdocrestores the old schema with ids. - Column defaults and Athena DDL-only clauses: Iceberg v3
initial-default/write-defaultand Hive/Athena-only clauses (ALTER TABLE ... SET LOCATION,bucketed_by) are not exposed byAWS::Glue::Table(useIcebergPartitionTransform.bucket(N)). - Engine v3 support: Athena queries v2 tables only, not v3; Spark and Iceberg at the versions listed in Format version 3 lack
TypeToSparkTypeconversion fortimestamp_ns,timestamptz_ns,geometry, andgeography(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 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cdk_glue_iceberg_table-1.0.0.tar.gz | 186.7 kB | With provenance | Details for cdk_glue_iceberg_table-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cdk_glue_iceberg_table-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cdk_glue_iceberg_table-1.0.0-py3-none-any.whl |
Total release size: 348.3 kB
Release files / cdk_glue_iceberg_table-1.0.0.tar.gz
| Download URL | cdk_glue_iceberg_table-1.0.0.tar.gz |
|---|---|
| Size | 186.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de63cf6594841a563114d5b29e6d4328ccd4b3bb8605836a59df5af1d128a317
|
|
BLAKE2b-256 checksum How to use checksums |
25ae7c5c9df030a317f5c38616bb674efe36416872d9ae48b7c4d9e405aa3a3d
|
| 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 30, 2026.
Transparency logRelease files / cdk_glue_iceberg_table-1.0.0-py3-none-any.whl
| Download URL | cdk_glue_iceberg_table-1.0.0-py3-none-any.whl |
|---|---|
| Size | 161.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f9c6f85e444e63f972fe349b353a2318440790fc1af6cf2d1fd6d5e86cbd17b
|
|
BLAKE2b-256 checksum How to use checksums |
ebb86438b1dd2976162cbcc25f020e64e044a54ad9bfc9cb4e0fe6676e6f2c23
|
| 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 30, 2026.
Transparency logSecurity for cdk-glue-iceberg-table 1.0.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.
Attestation for cdk_glue_iceberg_table-1.0.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 30, 2026.
Transparency logA 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.