Skip to content

Commit

Permalink
removed location from changelog, but always have it in snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
KushnirykOleh committed Oct 16, 2024
1 parent d850249 commit c0916c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public Change[] fixMissing(DatabaseObject missingObject, DiffOutputControl contr
if (changes == null || changes.length == 0) {
return changes;
}
//so far we intentionally omit tableLocation in generated changelog
ExtendedTableProperties extendedTableProperties = new ExtendedTableProperties(
missingObject.getAttribute("Location", String.class),
null,
missingObject.getAttribute("tblProperties", String.class));

changes[0] = getCreateTableChangeDatabricks(extendedTableProperties, changes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,12 @@ protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot
// DESCRIBE TABLE EXTENDED returns both columns and additional information.
// We need to make sure "Location" is not column in the table, but table location in s3
boolean detailedInformationNode = false;
boolean externalLocation = false;
for (Map<String, ?> tableProperty : tablePropertiesResponse) {
if (tableProperty.get("COL_NAME").equals(DETAILED_TABLE_INFORMATION_NODE)) {
detailedInformationNode = true;
continue;
}
if(detailedInformationNode && tableProperty.get("COL_NAME").equals(TYPE)) {
externalLocation = ((String)tableProperty.get("DATA_TYPE")).equalsIgnoreCase(EXTERNAL);
}
if (detailedInformationNode && externalLocation && tableProperty.get("COL_NAME").equals(LOCATION)) {
if (detailedInformationNode && tableProperty.get("COL_NAME").equals(LOCATION)) {
table.setAttribute(LOCATION, tableProperty.get("DATA_TYPE"));
}
if (detailedInformationNode && tableProperty.get("COL_NAME").equals(TABLE_PROPERTIES)) {
Expand Down

0 comments on commit c0916c8

Please sign in to comment.