generated from liquibase/liquibase-extension-example
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for creating partitioned tables
Add support and tests for creating partitioned tables
- Loading branch information
1 parent
39e7fdf
commit 990c4d4
Showing
6 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/test/resources/liquibase/harness/change/changelogs/databricks/createPartitionedTable.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" | ||
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/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> | ||
|
||
<changeSet id="1" author="codydavis"> | ||
<ext:createTable tableName="test_table_partitioned" partitionColumns = "partition_column"> | ||
<column name="test_id" type="int"> | ||
<constraints primaryKey="true" nullable="false"/> | ||
</column> | ||
<column name="test_column" type="varchar(50)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="partition_column" type="string"> | ||
<constraints nullable="false"/> | ||
</column> | ||
</ext:createTable> | ||
</changeSet> | ||
</databaseChangeLog> |
30 changes: 30 additions & 0 deletions
30
...esources/liquibase/harness/change/expectedSnapshot/databricks/createPartitionedTable.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"snapshot": { | ||
"objects": { | ||
"liquibase.structure.core.Table": [ | ||
{ | ||
"table": { | ||
"name": "test_table_partitioned" | ||
} | ||
} | ||
], | ||
"liquibase.structure.core.Column": [ | ||
{ | ||
"column": { | ||
"name": "test_id" | ||
} | ||
}, | ||
{ | ||
"column": { | ||
"name": "test_column" | ||
} | ||
}, | ||
{ | ||
"column": { | ||
"name": "partition_column" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...test/resources/liquibase/harness/change/expectedSql/databricks/createPartitionedTable.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CREATE TABLE main.liquibase_harness_test_ds.test_table_partitioned (test_id INT NOT NULL, test_column VARCHAR(50) NOT NULL, partition_column STRING NOT NULL, CONSTRAINT PK_TEST_TABLE_PARTITIONED PRIMARY KEY (test_id)) USING delta TBLPROPERTIES('delta.feature.allowColumnDefaults' = 'supported', 'delta.columnMapping.mode' = 'name') PARTITIONED BY (partition_column) |