Skip to content

Commit

Permalink
Adds generic SourceTag handling
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Grote <[email protected]>
  • Loading branch information
cmgrote committed Feb 13, 2025
1 parent 2a38572 commit f1a2e8d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,27 +182,28 @@ class AtlanTagImporter(

private fun idempotentTagAsset(tag: TagDetails): Asset? {
return if (tag.sourceSynced) {
val assetBuilder = when (tag.connectorType) {
"snowflake" -> {
// TODO: actually use a schema for Snowflake, not just a connection
SnowflakeTag.creator(
tag.name,
tag.connectionQualifiedName,
tag.name,
tag.tagIdInSource,
tag.allowedValues,
)
}
else -> {
SourceTag.creator(
tag.name,
tag.connectionQualifiedName,
tag.name,
tag.tagIdInSource,
tag.allowedValues,
)
val assetBuilder =
when (tag.connectorType) {
"snowflake" -> {
// TODO: actually use a schema for Snowflake, not just a connection
SnowflakeTag.creator(
tag.name,
tag.connectionQualifiedName,
tag.name,
tag.tagIdInSource,
tag.allowedValues,
)
}
else -> {
SourceTag.creator(
tag.name,
tag.connectionQualifiedName,
tag.name,
tag.tagIdInSource,
tag.allowedValues,
)
}
}
}
assetBuilder.build()
} else {
null
Expand Down
5 changes: 4 additions & 1 deletion sdk/src/main/java/com/atlan/model/assets/SnowflakeTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,10 @@ public static boolean restore(AtlanClient client, String qualifiedName) throws A
.connectionQualifiedName(connectionQualifiedName)
.mappedAtlanTagName(mappedAtlanTagName)
.tagId(snowflakeTagId)
.tagAttribute(SourceTagAttribute.of("allowedValues", allowedValuesString, null))
.tagAttribute(SourceTagAttribute.builder()
.tagAttributeKey("allowedValues")
.tagAttributeValue(allowedValuesString)
.build())
.tagAllowedValues(allowedValues);
}

Expand Down
7 changes: 5 additions & 2 deletions sdk/src/main/java/com/atlan/model/assets/SourceTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,10 @@ public static boolean restore(AtlanClient client, String qualifiedName) throws A
.connectionQualifiedName(connectionQualifiedName)
.mappedAtlanTagName(mappedAtlanTagName)
.tagId(sourceTagId)
.tagAttribute(SourceTagAttribute.of("allowedValues", allowedValuesString, null))
.tagAttribute(SourceTagAttribute.builder()
.tagAttributeKey("allowedValues")
.tagAttributeValue(allowedValuesString)
.build())
.tagAllowedValues(allowedValues);
}

Expand All @@ -400,7 +403,7 @@ public static boolean restore(AtlanClient client, String qualifiedName) throws A
* Generate a unique SourceTag name.
*
* @param name of the SourceTag
* @param connectionQualifiedName unique name of the connection in which this SourceTag exists
* @param connectionQualifiedName unique name of the schema in which this SourceTag exists
* @return a unique name for the SourceTag
*/
public static String generateQualifiedName(String name, String connectionQualifiedName) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/resources/templates/SnowflakeTag.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
.connectionQualifiedName(connectionQualifiedName)
.mappedAtlanTagName(mappedAtlanTagName)
.tagId(snowflakeTagId)
.tagAttribute(SourceTagAttribute.of("allowedValues", allowedValuesString, null))
.tagAttribute(SourceTagAttribute.builder().tagAttributeKey("allowedValues").tagAttributeValue(allowedValuesString).build())
.tagAllowedValues(allowedValues);
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/resources/templates/SourceTag.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
.connectionQualifiedName(connectionQualifiedName)
.mappedAtlanTagName(mappedAtlanTagName)
.tagId(sourceTagId)
.tagAttribute(SourceTagAttribute.of("allowedValues", allowedValuesString, null))
.tagAttribute(SourceTagAttribute.builder().tagAttributeKey("allowedValues").tagAttributeValue(allowedValuesString).build())
.tagAllowedValues(allowedValues);
}

Expand Down

0 comments on commit f1a2e8d

Please sign in to comment.