---
title: Create and use managed tables with Apache Iceberg v3
description: Create managed tables in Unity Catalog that use Apache Iceberg v3, and use v3 features such as deletion vectors, VARIANT, row lineage, and geospatial types.
canonical_url: https://docs.databricks.com/aws/en/iceberg/iceberg-v3
---

# Create and use managed tables with Apache Iceberg v3

Apache Iceberg v3 enhances query performance and introduces new capabilities for managed tables using Iceberg or Delta Lake with Iceberg reads in Unity Catalog.

The key features of Iceberg v3 are:

* **Deletion vectors**: Enable efficient, row-level deletes without rewriting entire data files. See [Deletion vectors in Databricks](https://docs.databricks.com/aws/en/tables/features/deletion-vectors.md).
* **VARIANT data type**: Supports storing and processing semi-structured data. See [Variant type support for Apache Iceberg and Delta Lake](https://docs.databricks.com/aws/en/tables/features/variant.md).
* **Row lineage**: Tracks incremental changes to table data. See [Row tracking in Databricks](https://docs.databricks.com/aws/en/tables/features/row-tracking.md).
* **GEOMETRY and GEOGRAPHY data types**: Store and query geospatial data for spatial analytics and joins. See [`GEOMETRY` type](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) and [`GEOGRAPHY` type](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md).
* **Write defaults**: Specify column values that apply to new rows when a write omits a column. See [Create a table with write defaults](https://docs.databricks.com/aws/en/iceberg/iceberg-v3.md#default-column-values).

## Requirements

To use managed tables with Iceberg v3 features, such as geospatial types, you must meet the following requirements:

* A workspace with Unity Catalog enabled.
* Databricks Runtime 18 LTS and above.

## <a id="create-new-table" />Create a managed table with Iceberg v3

Create new tables with Iceberg v3 enabled for both managed Delta Lake tables with Iceberg reads and managed Iceberg tables.

### Delta Lake

To create a new managed table using Delta Lake with Iceberg reads and Iceberg v3 enabled, use the following SQL command:

```sql
CREATE OR REPLACE TABLE main.schema.table (c1 INT) TBLPROPERTIES(
  'delta.universalFormat.enabledFormats' = 'iceberg',
  'delta.enableIcebergCompatV3' = 'true'
);
```

For more information about Iceberg reads, see [Read Delta Lake tables with Iceberg clients](https://docs.databricks.com/aws/en/delta/iceberg-reads.md).

### Iceberg

To create a new managed table using Iceberg v3, use the following SQL command:

```sql
CREATE OR REPLACE TABLE main.schema.table (c1 INT)
USING iceberg
TBLPROPERTIES ('format-version' = 3);
```

For more information about Iceberg tables, see [What is Apache Iceberg in Databricks?](https://docs.databricks.com/aws/en/iceberg/index.md).

## <a id="upgrade-existing-table" />Upgrade an existing table to Iceberg v3

You can upgrade an existing table to Iceberg v3 by:

1. Enabling any v3 feature on a table.
2. Setting the Iceberg format version on a table to 3 (shown below).

Run the upgrade from Databricks. External Iceberg engines can create a managed table with `format-version` set to 3, but they can't upgrade an existing table to v3.

> [!NOTE]
>
> Tables can be downgraded from v3 to v2 by restoring the table to a table version before the upgrade to v3 using `RESTORE`. See [Downgrade a table to a previous version](https://docs.databricks.com/aws/en/iceberg/iceberg-v3.md#restore-table).

### Delta Lake

To upgrade a managed table using Delta Lake with Iceberg reads to v3, use the following command:

```sql
ALTER TABLE catalog.schema.table SET TBLPROPERTIES(
  'delta.enableIcebergCompatV3' = 'true',
  'delta.enableIcebergCompatV2' = 'false'
);
```

### Iceberg

To upgrade a managed table using Iceberg to v3, use the following command:

```sql
ALTER TABLE catalog.schema.table SET TBLPROPERTIES (
  'format-version' = 3
);
```

## <a id="deletion-vectors" />Enable deletion vectors

Deletion vectors optimize row-level data modification operations and are enabled by default on all new Iceberg v3 tables. See [Deletion vectors in Databricks](https://docs.databricks.com/aws/en/tables/features/deletion-vectors.md).

> [!NOTE]
>
> Enabling deletion vectors on an existing Iceberg table upgrades the Iceberg format version to 3.

### Delta Lake

To create a new managed table using Delta Lake with Iceberg reads, Iceberg v3, and deletion vectors enabled, set the following table properties:

```sql
CREATE TABLE catalog.schema.table (c1 INT) TBLPROPERTIES(
  'delta.enableDeletionVectors' = 'true',
  'delta.enableIcebergCompatV3' = 'true',
  'delta.universalFormat.enabledFormats' = 'iceberg'
);
```

### Iceberg

To create a new managed table using Iceberg v3 with deletion vectors enabled, set the `iceberg.enableDeletionVectors` table property:

```sql
CREATE TABLE catalog.schema.table (c1 INT)
USING ICEBERG TBLPROPERTIES (
  'iceberg.enableDeletionVectors' = 'true'
);
```

## <a id="variant-data-type" />Use the VARIANT data type

The VARIANT data type allows you to store and query semi-structured data.

> [!NOTE]
>
> Using VARIANT in an existing Iceberg table upgrades the Iceberg format version to 3.

### Delta Lake

To create a new managed table using Delta Lake with Iceberg reads and a VARIANT column:

```sql
CREATE TABLE catalog.schema.deltaTable (col VARIANT) TBLPROPERTIES(
  'delta.enableIcebergCompatV3' = 'true',
  'delta.universalFormat.enabledFormats' = 'iceberg'
);
```

### Iceberg

To create a new managed table using Iceberg v3 with a VARIANT column:

```sql
CREATE TABLE catalog.schema.icebergTable (col VARIANT) USING iceberg;
```

To add a VARIANT column to an existing table, use the `ALTER TABLE` command:

```sql
ALTER TABLE catalog.schema.table ADD COLUMN variant_col VARIANT;
```

## <a id="geospatial-data-types" />Use GEOMETRY and GEOGRAPHY data types

Use the `GEOMETRY` and `GEOGRAPHY` data types to store and query geospatial data. See [`GEOMETRY` type](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geometry-type.md) and [`GEOGRAPHY` type](https://docs.databricks.com/aws/en/sql/language-manual/data-types/geography-type.md).

> [!NOTE]
>
> Using `GEOMETRY` or `GEOGRAPHY` in an existing Iceberg table upgrades the Iceberg format version to 3.

### Delta Lake

To create a new managed table using Delta Lake with Iceberg reads and `GEOMETRY` or `GEOGRAPHY` columns:

```sql
CREATE TABLE catalog.schema.table (
  geom_col GEOMETRY(3857),
  geog_col GEOGRAPHY(4326)
) TBLPROPERTIES(
  'delta.enableIcebergCompatV3' = 'true',
  'delta.universalFormat.enabledFormats' = 'iceberg'
);
```

### Iceberg

To create a new managed table using Iceberg v3 with `GEOMETRY` or `GEOGRAPHY` columns:

```sql
CREATE TABLE catalog.schema.table (
  geom_col GEOMETRY(3857),
  geog_col GEOGRAPHY(4326)
) USING iceberg;
```

To add a `GEOMETRY` or `GEOGRAPHY` column to an existing table, use the `ALTER TABLE` command:

```sql
ALTER TABLE catalog.schema.table ADD COLUMN geom_col GEOMETRY(3857);
ALTER TABLE catalog.schema.table ADD COLUMN geog_col GEOGRAPHY(4326);
```

## <a id="default-column-values" />Create a table with write defaults

Iceberg v3 defines two types of default values:

* **Write defaults** apply to new rows when a write omits the corresponding column. Databricks supports write defaults.
* **Initial defaults** apply to preexisting rows when a new column is added. Databricks doesn't support initial defaults.

### Delta Lake

To create a new managed table using Delta Lake with Iceberg reads and a write default:

```sql
CREATE TABLE catalog.schema.table (
  id INT,
  row_status STRING DEFAULT 'active'
) TBLPROPERTIES(
  'delta.enableIcebergCompatV3' = 'true',
  'delta.universalFormat.enabledFormats' = 'iceberg'
);
```

### Iceberg

To create a new managed table using Iceberg v3 with a write default:

```sql
CREATE TABLE catalog.schema.table (
  id INT,
  row_status STRING DEFAULT 'active'
) USING iceberg;
```

To see the default applied, insert a row without `row_status`:

```sql
INSERT INTO catalog.schema.table (id) VALUES (1);
SELECT * FROM catalog.schema.table;
```

The preceding query returns the following, with the default applied to `row_status`:

```Output
id  row_status
1   active
```

## <a id="restore-table" />Downgrade a table to a previous Apache Iceberg version

If you need to revert a table to a state before it was upgraded to Iceberg v3, you can use the `RESTORE` command.

```sql
set spark.databricks.delta.restore.protocolDowngradeAllowed = true;
RESTORE TABLE catalog.schema.table TO VERSION AS OF 1;
set spark.databricks.delta.restore.protocolDowngradeAllowed = false;
```

## <a id="limitations" />Limitations

Databricks supports version 3 of the Iceberg specification, with the following exceptions:

* Initial defaults aren't supported. When a new column is added, an initial default sets the value for preexisting rows.
* The following data types aren't supported:
  * Unknown type
  * Nanosecond precision timestamp.
* Multi-argument transforms aren't supported.
* External Iceberg clients can't commit equality delete files to managed Iceberg tables through the Iceberg REST catalog. For row-level changes (`DELETE`, `UPDATE`, or `MERGE`), the client must use copy-on-write mode or record deleted rows as [deletion vectors](https://docs.databricks.com/aws/en/iceberg/iceberg-v3.md#deletion-vectors). See [Iceberg REST catalog limitations](https://docs.databricks.com/aws/en/external-access/iceberg.md#limitations).
