Skip to content
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

FT-820 Add SnowflakeDynamicTable as possible parentType #1132

Merged
merged 12 commits into from
Dec 23, 2024
5 changes: 5 additions & 0 deletions sdk/src/main/java/com/atlan/model/assets/Column.java
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,11 @@ public ISQL getParent() {
.tableQualifiedName(tableQualifiedName)
.tablePartition(TablePartition.refByQualifiedName(parentQualifiedName));
break;
case SnowflakeDynamicTable.TYPE_NAME:
builder.tableName(parentName)
.tableQualifiedName(parentQualifiedName)
.snowflakeDynamicTable(SnowflakeDynamicTable.refByQualifiedName(parentQualifiedName));
break;
ErnestoLoma marked this conversation as resolved.
Show resolved Hide resolved
}
return builder;
}
Expand Down
3 changes: 0 additions & 3 deletions sdk/src/main/java/com/atlan/model/assets/ICatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ public static ICatalog getLineageReference(String typeName, String qualifiedName
case AzureServiceBusTopic.TYPE_NAME:
ref = AzureServiceBusTopic.refByQualifiedName(qualifiedName);
break;
case BusinessProcessModelEntity.TYPE_NAME:
ref = BusinessProcessModelEntity.refByQualifiedName(qualifiedName);
break;
case CalculationView.TYPE_NAME:
ref = CalculationView.refByQualifiedName(qualifiedName);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public class AttributeDefOptions extends AtlanObject {
BusinessPolicyException.TYPE_NAME,
BusinessPolicyIncident.TYPE_NAME,
BusinessPolicyLog.TYPE_NAME,
BusinessProcessModelEntity.TYPE_NAME,
CalculationView.TYPE_NAME,
Cognite3DModel.TYPE_NAME,
CogniteAsset.TYPE_NAME,
Expand Down
12 changes: 8 additions & 4 deletions sdk/src/main/java/com/atlan/util/AssetBatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.atlan.model.assets.Column;
import com.atlan.model.assets.IndistinctAsset;
import com.atlan.model.assets.MaterializedView;
import com.atlan.model.assets.SnowflakeDynamicTable;
import com.atlan.model.assets.Table;
import com.atlan.model.assets.View;
import com.atlan.model.core.AssetMutationResponse;
Expand All @@ -38,7 +39,7 @@
public class AssetBatch implements AtlanCloseable {

private static final Set<String> TABLE_LEVEL_ASSETS =
Set.of(Table.TYPE_NAME, View.TYPE_NAME, MaterializedView.TYPE_NAME);
Set.of(Table.TYPE_NAME, View.TYPE_NAME, MaterializedView.TYPE_NAME, SnowflakeDynamicTable.TYPE_NAME);

public enum CustomMetadataHandling {
IGNORE,
Expand Down Expand Up @@ -434,9 +435,8 @@ public synchronized AssetMutationResponse flush() throws AtlanException {
if (tableViewAgnostic) {
Set<String> typesInBatch =
_batch.stream().map(Asset::getTypeName).collect(Collectors.toSet());
fuzzyMatch = typesInBatch.contains(Table.TYPE_NAME)
|| typesInBatch.contains(View.TYPE_NAME)
|| typesInBatch.contains(MaterializedView.TYPE_NAME);
typesInBatch.retainAll(TABLE_LEVEL_ASSETS);
fuzzyMatch = !typesInBatch.isEmpty();
}
if (updateOnly || creationHandling != AssetCreationHandling.FULL || fuzzyMatch) {
Map<AssetIdentity, String> found = new HashMap<>();
Expand Down Expand Up @@ -475,12 +475,16 @@ public synchronized AssetMutationResponse flush() throws AtlanException {
new AssetIdentity(View.TYPE_NAME, asset.getQualifiedName(), caseInsensitive);
AssetIdentity asMaterializedView = new AssetIdentity(
MaterializedView.TYPE_NAME, asset.getQualifiedName(), caseInsensitive);
AssetIdentity asDynamicTable = new AssetIdentity(
SnowflakeDynamicTable.TYPE_NAME, asset.getQualifiedName(), caseInsensitive);
if (found.containsKey(asTable)) {
addFuzzyMatched(asset, Table.TYPE_NAME, found.get(asTable), revised);
} else if (found.containsKey(asView)) {
addFuzzyMatched(asset, View.TYPE_NAME, found.get(asView), revised);
} else if (found.containsKey(asMaterializedView)) {
addFuzzyMatched(asset, MaterializedView.TYPE_NAME, found.get(asMaterializedView), revised);
} else if (found.containsKey(asDynamicTable)) {
addFuzzyMatched(asset, SnowflakeDynamicTable.TYPE_NAME, found.get(asDynamicTable), revised);
} else if (creationHandling == AssetCreationHandling.PARTIAL) {
// Still create it (partial), if not found and partial asset creation is allowed
addPartialAsset(asset, revised);
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/main/resources/templates/Column.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@
.tableQualifiedName(tableQualifiedName)
.tablePartition(TablePartition.refByQualifiedName(parentQualifiedName));
break;
case SnowflakeDynamicTable.TYPE_NAME:
builder.tableName(parentName)
.tableQualifiedName(parentQualifiedName)
.snowflakeDynamicTable(SnowflakeDynamicTable.refByQualifiedName(parentQualifiedName));
break;
}
return builder;
}
Expand Down
Loading