Skip to content

Commit 5006757

Browse files
authored
Merge pull request #1014 from atlanhq/DVX-760
Asset import improvements
2 parents c2a3bf2 + 23401d2 commit 5006757

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Diff for: samples/packages/asset-import/src/main/kotlin/com/atlan/pkg/aim/AssetImporter.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,11 @@ class AssetImporter(
251251

252252
/** {@inheritDoc} */
253253
override fun import(columnsToSkip: Set<String>): ImportResults? {
254+
val colsToSkip = columnsToSkip.toMutableSet()
255+
colsToSkip.add(Asset.GUID.atlanFieldName)
254256
if (updateOnly) {
255257
// If we're only updating, process as before (in-parallel, any order)
256-
return super.import(columnsToSkip)
258+
return super.import(colsToSkip)
257259
} else {
258260
// Otherwise, we need to do multi-pass loading:
259261
// - Import assets in tiered order, top-to-bottom
@@ -271,7 +273,7 @@ class AssetImporter(
271273
typeLoadingOrder.forEach {
272274
typeToProcess = it
273275
logger.info { "--- Importing $typeToProcess assets... ---" }
274-
val results = super.import(columnsToSkip)
276+
val results = super.import(colsToSkip)
275277
individualResults.add(results)
276278
}
277279
return ImportResults.combineAll(Atlan.getDefaultClient(), true, *individualResults.toTypedArray())

Diff for: sdk/src/main/java/com/atlan/util/AssetBatch.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.atlan.model.enums.AssetCreationHandling;
2121
import com.atlan.model.relations.Reference;
2222
import com.atlan.model.search.FluentSearch;
23+
import com.atlan.model.search.IndexSearchDSL;
2324
import com.atlan.serde.Serde;
2425
import java.io.Closeable;
2526
import java.io.IOException;
@@ -485,11 +486,12 @@ public synchronized AssetMutationResponse flush() throws AtlanException {
485486
} else {
486487
builder = client.assets.select(true).where(Asset.QUALIFIED_NAME.in(qualifiedNames));
487488
}
488-
builder.pageSize(maxSize).stream().forEach(asset -> {
489-
AssetIdentity assetId =
490-
new AssetIdentity(asset.getTypeName(), asset.getQualifiedName(), caseInsensitive);
491-
found.put(assetId, asset.getQualifiedName());
492-
});
489+
builder.pageSize(Math.max(maxSize * 2, IndexSearchDSL.DEFAULT_PAGE_SIZE)).stream()
490+
.forEach(asset -> {
491+
AssetIdentity assetId =
492+
new AssetIdentity(asset.getTypeName(), asset.getQualifiedName(), caseInsensitive);
493+
found.put(assetId, asset.getQualifiedName());
494+
});
493495
revised = new ArrayList<>();
494496
for (Asset asset : _batch) {
495497
AssetIdentity assetId =
@@ -519,7 +521,7 @@ public synchronized AssetMutationResponse flush() throws AtlanException {
519521
addPartialAsset(asset, revised);
520522
} else if (creationHandling == AssetCreationHandling.FULL) {
521523
// Still create it (full), if not found and full asset creation is allowed
522-
revised.addAll(_batch);
524+
revised.add(asset);
523525
} else {
524526
// Otherwise, if it still does not match any fallback and cannot be created, skip it
525527
track(skipped, asset);

0 commit comments

Comments
 (0)