Identity Columns¶
Identity Columns is a new feature in Delta Lake 3.3.0 that allows assigning unique values for each record written out into a table (unless column values are provided explicitly).
Identity Columns feature is enabled by default (using spark.databricks.delta.identityColumn.enabled).
Identity Columns feature is supported by delta tables that meet one of the following requirements:
- The tables must be on Writer Version 6
- The table must be on Writer Version 7, and a feature name
identityColumns
must exist in the table protocol'swriterFeatures
.
Identity Columns cannot be specified with a generated column expression (or a DeltaAnalysisException
is reported).
Identity Columns can only be of LongType
.
IDENTITY column step cannot be 0 (or a DeltaAnalysisException
is reported).
Internally, identity columns are columns (fields) with the following Metadata
:
Key | Value |
---|---|
delta.identity.allowExplicitInsert | identityAllowExplicitInsert |
delta.identity.start | identityStart |
delta.identity.step | identityStep |
IdentityColumn and ColumnWithDefaultExprUtils utilities are used to work with identity columns.
Learn More¶
- Identity Columns in Delta Lake's table protocol specification