Skip to content

Commit

Permalink
PD-5158: Databricks syncIdentityColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-velonis1 committed Jan 7, 2025
1 parent beda2f5 commit 399aa15
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
</ul>
<p MadCap:conditions="exclude.future-databricks">Databricks-specific <MadCap:variable name="General.changetypes" />s that require <MadCap:variable name="General.LBPro" />:</p>
<ul MadCap:conditions="exclude.future-databricks">
<li><code>syncIdentityColumn</code>
</li>
<li><code><MadCap:xref href="../../../../change-types/databricks/sync-identity-column.html">syncIdentityColumn</MadCap:xref></code>: synchronizes identity column metadata with actual data</li>
</ul>
<p><MadCap:variable name="General.Liquibase" />&#160;<MadCap:variable name="General.changetypes" />s that accept Databricks <MadCap:variable name="General.Param/Attribute" />s or sub-tags:</p>
<ul>
Expand Down
127 changes: 127 additions & 0 deletions Content/change-types/databricks/sync-identity-column.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:searchable="False" MadCap:conditions="exclude.future-databricks">
<head><title><MadCap:variable name="Heading.Level1" /></title>
<link rel="canonical" href="https://docs.liquibase.com/change-types/databricks/sync-identity-column.html" />
<meta name="description" content="Reference information for the syncIdentityColumn changetype. syncIdentityColumn is a changetype in the Liquibase Databricks Pro Source extension that synchronizes identity column metadata with actual data." />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<h1 id="analyze-table"><code>syncIdentityColumn</code>
</h1>
<p><code class="language-text">syncIdentityColumn</code> is a <MadCap:variable name="General.changetypes" /> in the <a href="../../start/tutorials/databricks/home.htm"><MadCap:variable name="General.LBPro" /> Databricks extension</a> that synchronizes identity column metadata with actual data. It is available in the <MadCap:variable name="General.LBPro" /> Databricks extension 1.0.0 and later.</p>
<h2>Uses</h2>
<p>An identity column in Databricks defines the mechanism to create a unique identifier for each row in the table. It contains metadata like a <code class="language-text">start</code> and <code class="language-text">step</code> (increment) value.</p>
<p>If you write your own values to an identity column, it might not comply with the metadata. You can use <code class="language-text">syncIdentityColumn</code> to evaluate the state and update the metadata to be consistent with the actual data you specified.</p>
<p>For more information, see <a href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table-manage-column.html">ALTER TABLE … COLUMN clause</a>.</p>
<h2>Run <code>syncIdentityColumn</code></h2>
<MadCap:snippetBlock src="../../Z_Resources/Snippets/text/change-type-run-syntax.flsnp" />
<h2 id="available-attributes">Available <MadCap:variable name="General.Param/Attribute" />s</h2>
<MadCap:snippetBlock src="../../Z_Resources/Snippets/note/database-required-attributes.flsnp" />
<table>
<col />
<col />
<col />
<col />
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Requirement</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="language-text">tableName</code>
</td>
<td>String</td>
<td>
<MadCap:snippetText src="../../Z_Resources/Snippets/def/attributes/change-types/change-type-table-name.flsnp" /> containing the column to sync.</td>
<td><b>Required</b>
</td>
</tr>
<tr>
<td><code class="language-text">columnName</code>
</td>
<td>String</td>
<td>
<MadCap:snippetText src="../../Z_Resources/Snippets/def/attributes/change-types/change-type-column-name.flsnp" /> to sync.</td>
<td><b>Required</b>
</td>
</tr>
<tr>
<td><code class="language-text">catalogName</code>
</td>
<td>String</td>
<td>
<MadCap:snippetBlock src="../../Z_Resources/Snippets/def/attributes/change-types/change-type-catalog-name.flsnp" />
</td>
<td>Optional</td>
</tr>
<tr>
<td><code class="language-text">schemaName</code>
</td>
<td>String</td>
<td>
<MadCap:snippetBlock src="../../Z_Resources/Snippets/def/attributes/change-types/change-type-schema-name.flsnp" />
</td>
<td>Optional</td>
</tr>
</tbody>
</table>
<h2 id="examples">Examples</h2>
<p class="note" MadCap:autonum="&lt;b&gt;Note: &lt;/b&gt;">Rollback is not supported for <code>syncIdentityColumn</code>.</p>
<div class="js-tabs">
<ul class="js-tablist" data-hx="h3">
<li class="js-tablist__item"><a href="#yaml_example" id="label_yaml_example" class="js-tablist__link">YAML example</a>
</li>
<li class="js-tablist__item"><a href="#json_example" id="label_json_example" class="js-tablist__link">JSON example</a>
</li>
<li class="js-tablist__item"><a href="#xml_example" id="label_xml_example" class="js-tablist__link">XML example</a>
</li>
</ul>
<div id="yaml_example" class="js-tabcontent"><pre xml:space="preserve"><code class="language-yaml">databaseChangeLog:
- changeSet:
id: 2
author: your.name
changes:
- syncIdentityColumn:
tableName: test_identity_table
columnName: test_column</code></pre>
</div>
<div id="json_example" class="js-tabcontent"><pre xml:space="preserve"><code class="language-json">{
"databaseChangeLog": [
{
"changeSet": {
"id": "2",
"author": "your.name",
"changes": [
{
"syncIdentityColumn": {
"tableName": "test_identity_table",
"columnName": "test_column"
}
}
]
}
}
]
}</code></pre>
</div>
<div id="xml_example" class="js-tabcontent"><pre xml:space="preserve"><code class="language-xml"><MadCap:snippetText src="../../Z_Resources/Snippets/code/liquibase-xsd-xml-changelog-databricks.flsnp" />

&lt;changeSet id="2" author="your.name"&gt;
&lt;databricks-pro:syncIdentityColumn tableName="test_identity_table" columnName="test_column"/&gt;
&lt;/changeSet&gt;

&lt;/databaseChangeLog&gt;</code></pre>
</div>
</div>
<MadCap:snippetBlock src="../../Z_Resources/Snippets/text/change-type-databricks-database-support.flsnp" />
<h2>Related links</h2>
<ul>
<li><a href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table-manage-column.html">Databricks SQL Reference: ALTER TABLE … COLUMN clause</a>
</li>
</ul>
</body>
</html>
4 changes: 4 additions & 0 deletions Project/TOCs/TOC.fltoc
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,10 @@
<TocEntry
Title="[%=System.LinkedHeader%]"
Link="/Content/change-types/databricks/optimize-table.html" />
<TocEntry
Title="[%=System.LinkedHeader%]"
Link="/Content/change-types/databricks/sync-identity-column.html"
conditions="exclude.future-databricks" />
<TocEntry
Title="[%=System.LinkedHeader%]"
Link="/Content/change-types/databricks/vacuum-table.html"></TocEntry>
Expand Down

0 comments on commit 399aa15

Please sign in to comment.