Skip to content

INT-1296 - Support to capture table description during snapshot #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/lth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
with:
name: terraform-state
path: src/test/terraform/terraform.tfstate

liquibase-test-harness:
name: Liquibase Test Harness
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
with:
java-version: 17
distribution: temurin
cache: 'maven'
cache: "maven"

- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v22
Expand Down Expand Up @@ -187,5 +187,6 @@ jobs:
echo "Terraform state is empty. Skipping terraform destroy."
else
echo "Schema found in Terraform state. Destroying"
terraform destroy -auto-approve
terraform destroy -auto-approve
fi

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Class<? extends SnapshotGenerator>[] replaces() {

/**
* Override the default implementation to ARRAY, MAP and STRUCT complex types as
* Liquibase core does not know how to handle values between <> in the data type.
* Liquibase core does not know how to handle values between &lt;&gt; in the data type.
*/
@Override
protected DataType readDataType(CachedRow columnMetadataResultSet, Column column, Database database) throws DatabaseException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class TableSnapshotGeneratorDatabricks extends TableSnapshotGenerator {
private static final String DETAILED_TABLE_INFORMATION_NODE = "# Detailed Table Information";
private static final String TABLE_PARTITION_INFORMATION_NODE = "# Partition Information";
private static final String DATA_TYPE = "DATA_TYPE";
private static final String COMMENT = "Comment";
private static final List<String> FILE_TYPE_PROVIDERS = Arrays.asList("AVRO", "BINARYFILE", "CSV", "JSON", "ORC", "PARQUET", "TEXT");

@Override
Expand Down Expand Up @@ -77,6 +78,9 @@ protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot
if (currentColName.equals(LOCATION)) {
table.setAttribute(LOCATION, tableProperty.get(DATA_TYPE));
}
if (currentColName.equals(COMMENT)) {
table.setRemarks((String) tableProperty.get(DATA_TYPE));
}
if (currentColName.equals(PROVIDER) && FILE_TYPE_PROVIDERS.contains(tableProperty.get(DATA_TYPE).toString().toUpperCase())) {
tableFormat.append(tableProperty.get(DATA_TYPE));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
http://www.liquibase.org/xml/ns/databricks http://www.liquibase.org/xml/ns/databricks/liquibase-databricks-latest.xsd">

<changeSet id="1" author="oleh">
<createTable tableName="test_table">
<createTable tableName="test_table" remarks="This comprehensive dataset contains detailed transaction records for our global e-commerce platform spanning multiple regions and product categories.">
<column name="test_id" type="int">
<constraints primaryKey="true" nullable="false"/>
</column>
Expand All @@ -17,7 +17,7 @@
</changeSet>

<changeSet id="2" author="as">
<createTable tableName="test_table_properties">
<createTable tableName="test_table_properties" remarks="This table includes configuration properties with vendor settings and customer preferences for application behavior.">
<column name="test_id" type="int">
<constraints primaryKey="true" nullable="false"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"name": "test_table",
"schema": "liquibase.structure.core.Schema#.*",
"snapshotId": ".*",
"remarks": "This comprehensive dataset contains detailed transaction records for our global e-commerce platform spanning multiple regions and product categories.",
"tblProperties": "'delta.checkpoint.writeStatsAsJson'='false', 'delta.checkpoint.writeStatsAsStruct'='true', 'delta.columnMapping.maxColumnId'='2', 'delta.columnMapping.mode'='name', 'delta.enableDeletionVectors'='true', 'delta.feature.allowColumnDefaults'='supported', 'delta.feature.appendOnly'='supported', 'delta.feature.columnMapping'='supported', 'delta.feature.deletionVectors'='supported', 'delta.feature.invariants'='supported', 'delta.minReaderVersion'='3', 'delta.minWriterVersion'='7'"
}
},
Expand All @@ -44,6 +45,7 @@
"name": "test_table_properties",
"schema": "liquibase.structure.core.Schema#.*",
"snapshotId": ".*",
"remarks": "This table includes configuration properties with vendor settings and customer preferences for application behavior.",
"tblProperties": "'delta.checkpoint.writeStatsAsJson'='false', 'delta.checkpoint.writeStatsAsStruct'='true', 'delta.columnMapping.maxColumnId'='1', 'delta.columnMapping.mode'='name', 'delta.enableDeletionVectors'='true', 'delta.feature.allowColumnDefaults'='supported', 'delta.feature.appendOnly'='supported', 'delta.feature.columnMapping'='supported', 'delta.feature.deletionVectors'='supported', 'delta.feature.invariants'='supported', 'delta.minReaderVersion'='3', 'delta.minWriterVersion'='7', 'this.is.my.key'='12', 'this.is.my.key2'='true'"
}
}
Expand Down

This file was deleted.

Loading