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 fb8fa2d commit 2a38572
Show file tree
Hide file tree
Showing 311 changed files with 477 additions and 322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import AssetImportCfg
import com.atlan.exception.NotFoundException
import com.atlan.model.assets.Asset
import com.atlan.model.assets.SnowflakeTag
import com.atlan.model.enums.AtlanConnectorType
import com.atlan.model.assets.SourceTag
import com.atlan.model.enums.AtlanEnum
import com.atlan.model.enums.AtlanIcon
import com.atlan.model.enums.AtlanTagColor
Expand All @@ -26,7 +26,6 @@ import de.siegmar.fastcsv.reader.CsvRecord
import mu.KLogger
import java.io.IOException
import java.nio.file.Paths
import java.util.concurrent.ThreadLocalRandom
import java.util.concurrent.atomic.AtomicLong
import kotlin.streams.asSequence

Expand Down Expand Up @@ -104,6 +103,7 @@ class AtlanTagImporter(
row.getOrElse(TAG_ICON) { "" },
row.getOrElse(TAG_CONNECTION) { "" },
row.getOrElse(TAG_CONNECTOR) { "" }.lowercase(),
row.getOrElse(TAG_SRC_ID) { "" },
CellXformer.parseDelimitedList(row.getOrElse(ALLOWED_VALUES) { "" }),
)

Expand Down Expand Up @@ -181,8 +181,33 @@ class AtlanTagImporter(
}

private fun idempotentTagAsset(tag: TagDetails): Asset? {
// TODO: replace with creator() call, and generic SourceTag — should be idempotent already (?)
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,
)
}
}
assetBuilder.build()
} else {
null
}
/*return if (tag.sourceSynced) {
// Source tag asset
val assetBuilder =
SnowflakeTag
Expand All @@ -200,7 +225,7 @@ class AtlanTagImporter(
assetBuilder.build()
} else {
null
}
}*/
}

companion object {
Expand All @@ -209,17 +234,8 @@ class AtlanTagImporter(
const val TAG_ICON = "Icon"
const val TAG_CONNECTION = "Synced connection name"
const val TAG_CONNECTOR = "Synced connector type"
const val TAG_SRC_ID = "Tag ID in source"
const val ALLOWED_VALUES = "Allowed values for tag"
val HEADER =
listOf(
TAG_NAME,
TAG_COLOR,
TAG_ICON,
TAG_CONNECTION,
TAG_CONNECTOR,
ALLOWED_VALUES,
)
const val NO_CONNECTION_QN = "NO_CONNECTION_FOUND"

fun getTagName(
row: List<String>,
Expand Down Expand Up @@ -251,6 +267,7 @@ class AtlanTagImporter(
val icon: String,
val connectionName: String,
val connectorType: String,
val tagIdInSource: String,
val allowedValues: List<String>,
) {
val connectionQualifiedName: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TagManagementTest : PackageTest("tm") {
override val logger = Utils.getLogger(this.javaClass.name)

private val c1 = makeUnique("c1")
private val c1Type = AtlanConnectorType.SNOWFLAKE // TODO: swap to BigID once generic SourceTag is in place
private val c1Type = AtlanConnectorType.BIGID
private val t1 = makeUnique("t1")
private val t2 = makeUnique("t2")

Expand Down
6 changes: 3 additions & 3 deletions samples/packages/asset-import/src/test/resources/tags.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Atlan tag name,Color,Icon,Synced connection name,Synced connector type,Allowed values for tag
Atlan tag name,Color,Icon,Synced connection name,Synced connector type,Allowed values for tag,Tag ID in source
{{TAG1}},Green,PhRecycle,{{CONNECTION}},{{CTYPE}},"X
Y
Z"
{{TAG2}},,https://assets.atlan.com/assets/announcement-issue-png.png,,,
Z",42
{{TAG2}},,https://assets.atlan.com/assets/announcement-issue-png.png,,,,
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/Asset.java
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ public abstract class Asset extends Reference implements IAsset, IReferenceable
@Attribute
Double popularityScore;

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
@Attribute
String qualifiedName;

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IADF.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public interface IADF {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IADLS.java
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public interface IADLS {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IADLSAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public interface IADLSAccount {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ public interface IADLSContainer {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IADLSObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public interface IADLSObject {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAI.java
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public interface IAI {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public interface IAIApplication {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAIModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public interface IAIModel {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public interface IAPI {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAPIField.java
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public interface IAPIField {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAPIObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public interface IAPIObject {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAPIPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public interface IAPIPath {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAPIQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public interface IAPIQuery {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAPISpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public interface IAPISpec {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAWS.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public interface IAWS {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public interface IAccessControl {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAdfActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ public interface IAdfActivity {
/** Lineage process that associates this ADF Activity. */
SortedSet<ILineageProcess> getProcesses();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAdfDataflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public interface IAdfDataflow {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAdfDataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public interface IAdfDataset {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public interface IAdfLinkedservice {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAdfPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public interface IAdfPipeline {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAirflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public interface IAirflow {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAirflowDag.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public interface IAirflowDag {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAirflowTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ public interface IAirflowTask {
/** Process in which this task exists. */
ILineageProcess getProcess();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAnaplan.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public interface IAnaplan {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAnaplanApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public interface IAnaplanApp {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public interface IAnaplanDimension {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public interface IAnaplanLineItem {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/model/assets/IAnaplanList.java
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public interface IAnaplanList {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public interface IAnaplanModel {
/** Popularity score for this asset. */
Double getPopularityScore();

/** TBC */
/** Unique name for this asset. This is typically a concatenation of the asset's name onto its parent's qualifiedName. This must be unique across all assets of the same type. */
String getQualifiedName();

/** README that is linked to this asset. */
Expand Down
Loading

0 comments on commit 2a38572

Please sign in to comment.