syncIdentityColumn
syncIdentityColumn
is a Change Type in the Liquibase Pro Databricks extension that synchronizes identity column metadata with actual data. It is available in the Liquibase Pro Databricks extension 1.0.0 and later.
Uses
An identity column in Databricks defines the mechanism to create a unique identifier for each row in the table. It contains metadata like a start
and step
(increment) value.
If you write your own values to an identity column, it might not comply with the metadata. You can use syncIdentityColumn
to evaluate the state and update the metadata to be consistent with the actual data you specified.
For more information, see ALTER TABLE … COLUMN clause.
Run syncIdentityColumn
To run this Change Type, follow these steps:
- Add the Change Type to your changeset, as shown in the examples on this page.
- Specify any required attributes. Use the table on this page to see which ones your database requires.
- Deploy your changeset by running the
update
command:
liquibase update
Available attributes
Tip: You must specify all top-level attributes marked as required. If you specify an optional attribute, you must also specify any nested attributes that it requires.
Name | Type | Description | Requirement |
---|---|---|---|
tableName
|
String | Name of the table containing the column to sync. | Required |
columnName
|
String | Name of the column to sync. | Required |
catalogName
|
String |
Name of the catalog |
Optional |
schemaName
|
String |
Name of the schema |
Optional |
Examples
Note: Rollback is not supported for syncIdentityColumn
.
databaseChangeLog:
- changeSet:
id: 2
author: your.name
changes:
- syncIdentityColumn:
tableName: test_identity_table
columnName: test_column
{
"databaseChangeLog": [
{
"changeSet": {
"id": "2",
"author": "your.name",
"changes": [
{
"syncIdentityColumn": {
"tableName": "test_identity_table",
"columnName": "test_column"
}
}
]
}
}
]
}
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:databricks="http://www.liquibase.org/xml/ns/databricks"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/databricks
http://www.liquibase.org/xml/ns/databricks/liquibase-databricks-latest.xsd
http://www.liquibase.org/xml/ns/pro
http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
<changeSet id="2" author="your.name">
<databricks-pro:syncIdentityColumn tableName="test_identity_table" columnName="test_column"/>
</changeSet>
</databaseChangeLog>
Database support
This Change Type is only supported for Databricks. It does not support auto rollback.