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.
Merge pull request #69 from liquibase/snapshot_support_update
Add Fixes for Snapshotting Databricks Tables
- Loading branch information
Showing
16 changed files
with
433 additions
and
77 deletions.
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
Binary file not shown.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
url: jdbc:databricks://<workspace_url>:443/default;transportMode=http;ssl=1;httpPath=sql/<warehouse_id>;AuthMech=3;ConnCatalog=main;ConnSchema=liquibase_harness_test_ds; | ||
username: token | ||
password: <dbx_token> | ||
url= jdbc:databricks://<workspace_url>:443/default;transportMode=http;ssl=1;httpPath=sql/<warehouse_id>;AuthMech=3;ConnCatalog=main;ConnSchema=liquibase_harness_test_ds; | ||
username= token | ||
password= <dbx_token> |
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
51 changes: 51 additions & 0 deletions
51
src/main/java/liquibase/ext/databricks/datatype/BigintDatatypeDatabricks.java
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,51 @@ | ||
package liquibase.ext.databricks.datatype; | ||
|
||
import liquibase.datatype.core.BigIntType; | ||
import liquibase.change.core.LoadDataChange; | ||
import liquibase.database.Database; | ||
import liquibase.datatype.DataTypeInfo; | ||
import liquibase.datatype.DatabaseDataType; | ||
import liquibase.datatype.LiquibaseDataType; | ||
import liquibase.ext.databricks.database.DatabricksDatabase; | ||
|
||
|
||
|
||
@DataTypeInfo(name = "bigint", aliases = {"java.sql.Types.BIGINT", "java.math.BigInteger", "java.lang.Long", "integer8", "bigserial", "serial8", "int8"}, minParameters = 0, maxParameters = 0, priority = DatabricksDatabase.PRIORITY_DATABASE) | ||
public class BigintDatatypeDatabricks extends BigIntType { | ||
|
||
private boolean autoIncrement; | ||
|
||
@Override | ||
public boolean isAutoIncrement() { | ||
return autoIncrement; | ||
} | ||
|
||
public void setAutoIncrement(boolean autoIncrement) { | ||
this.autoIncrement = autoIncrement; | ||
} | ||
|
||
@Override | ||
public DatabaseDataType toDatabaseDataType(Database database) { | ||
if (database instanceof DatabricksDatabase) { | ||
return new DatabaseDataType("BIGINT"); | ||
} | ||
|
||
return super.toDatabaseDataType(database); | ||
} | ||
|
||
@Override | ||
public boolean supports(Database database) { | ||
return database instanceof DatabricksDatabase; | ||
} | ||
|
||
@Override | ||
public int getPriority() { | ||
return PRIORITY_DATABASE; | ||
} | ||
|
||
|
||
@Override | ||
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { | ||
return LoadDataChange.LOAD_DATA_TYPE.NUMERIC; | ||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
src/main/java/liquibase/ext/databricks/datatype/IntegerDatatypeDatabricks.java
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,42 @@ | ||
package liquibase.ext.databricks.datatype; | ||
|
||
import liquibase.change.core.LoadDataChange; | ||
import liquibase.database.Database; | ||
import liquibase.datatype.DataTypeInfo; | ||
import liquibase.datatype.DatabaseDataType; | ||
import liquibase.datatype.LiquibaseDataType; | ||
import liquibase.ext.databricks.database.DatabricksDatabase; | ||
|
||
import static liquibase.ext.databricks.database.DatabricksDatabase.PRIORITY_DATABASE; | ||
|
||
|
||
@DataTypeInfo( | ||
name = "int", | ||
minParameters = 0, | ||
maxParameters = 0, | ||
priority = PRIORITY_DATABASE | ||
) | ||
public class IntegerDatatypeDatabricks extends LiquibaseDataType { | ||
public IntegerDatatypeDatabricks() { | ||
} | ||
|
||
public boolean supports(Database database) { | ||
return database instanceof DatabricksDatabase; | ||
} | ||
|
||
public DatabaseDataType toDatabaseDataType(Database database) { | ||
if (database instanceof DatabricksDatabase) { | ||
|
||
DatabaseDataType type = new DatabaseDataType("INT", this.getParameters()); | ||
type.setType("INT"); | ||
return type; | ||
} else { | ||
return super.toDatabaseDataType(database); | ||
} | ||
|
||
} | ||
|
||
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { | ||
return LoadDataChange.LOAD_DATA_TYPE.NUMERIC; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/liquibase/ext/databricks/datatype/StringDatatypeDatabricks.java
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,44 @@ | ||
package liquibase.ext.databricks.datatype; | ||
|
||
import liquibase.change.core.LoadDataChange; | ||
import liquibase.database.Database; | ||
import liquibase.datatype.DataTypeInfo; | ||
import liquibase.datatype.DatabaseDataType; | ||
import liquibase.datatype.LiquibaseDataType; | ||
import liquibase.ext.databricks.database.DatabricksDatabase; | ||
|
||
import static liquibase.ext.databricks.database.DatabricksDatabase.PRIORITY_DATABASE; | ||
|
||
|
||
@DataTypeInfo( | ||
name = "string", | ||
minParameters = 0, | ||
maxParameters = 0, | ||
priority = PRIORITY_DATABASE | ||
) | ||
public class StringDatatypeDatabricks extends LiquibaseDataType { | ||
public StringDatatypeDatabricks() { | ||
} | ||
|
||
public boolean supports(Database database) { | ||
return database instanceof DatabricksDatabase; | ||
} | ||
|
||
public DatabaseDataType toDatabaseDataType(Database database) { | ||
if (database instanceof DatabricksDatabase) { | ||
|
||
DatabaseDataType type = new DatabaseDataType("STRING"); | ||
|
||
type.setType("STRING"); | ||
|
||
return type; | ||
} else { | ||
return super.toDatabaseDataType(database); | ||
} | ||
|
||
} | ||
|
||
public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() { | ||
return LoadDataChange.LOAD_DATA_TYPE.STRING; | ||
} | ||
} |
Oops, something went wrong.