limit in find asset
Hi,
I would like to populate a new attribut in bulk that record the status of tables before they become “missing from source”
My script works well but only on the 1000 fist tables.
And when I launch again the workflow it does not go to the next 1000 tables
I don’t know how to change this
This is a one shoot workflow as I develop an other workflow with a trigger for the futur
Here my code
import com.collibra.dgc.core.api.dto.instance.attribute.FindAttributesRequest
import com.collibra.dgc.core.api.dto.instance.asset.SetAssetAttributesRequest
import com.collibra.dgc.core.api.dto.instance.asset.FindAssetsRequest
import com.collibra.dgc.core.api.dto.instance.asset.ChangeAssetRequest
infoListTable = assetApi.findAssets(FindAssetsRequest.builder()
.typeIds([string2Uuid(tableAssetTypeId)])
.communityId(string2Uuid(technicalAssetCommunity))
.build()
)getResults()
//On récupère toutes les tables
infoListTable.each
{ asset ->
def tableId = asset.getId()
loggerApi.info(“tableId :” + tableId)
def tableDisplayName = assetApi.getAsset(asset.getId()).getDisplayName()
loggerApi.info(“tableDisplayName :” + tableDisplayName)
def tableAsset = assetApi.getAsset(asset.id)
loggerApi.info(“tableAsset :” + tableAsset)
def status = tableAsset.getStatus()
loggerApi.info(“status :” + status)
def statusId = status.getId()
execution.setVariable(‘statusId’, statusId)
loggerApi.info(“statusId :” + statusId)
def statusIdString = status.getId().toString()
loggerApi.info(“statusIdString :” + statusIdString)
if (statusBeforeMissingFromSourceAttributeTypeId == null)
{
if (statusId != (string2Uuid(missingFromSourceStatusId)))
{
loggerApi.info("TEST IF :" + "TESTIF")
assetApi.setAssetAttributes(SetAssetAttributesRequest.builder()
.assetId(tableId)
.typeId(string2Uuid(statusBeforeMissingFromSourceAttributeTypeId))
.values([statusIdString])
.build())
}
}
}
daphnozbek
·3 years ago · EditedHi,
It works well with a loop before the find table
BR
Daphné
arthurburkhardt
·4 years ago · EditedTwo suggestions:
Finally, you could just use the importApi to update the informations.
ravi
·4 years ago · EditedHi @daphne.ozbek
Could you use a logger to see the count for infoListTable.
Alternatively, try using,
infoListTable = assetApi.findAssets(FindAssetsRequest.builder()
.typeIds([string2Uuid(tableAssetTypeId)])
.communityId(string2Uuid(technicalAssetCommunity))
.limit(100000)
.build()
)getResults()
Daphné OZBEK
OP4 years ago · EditedHi @ravi_collibra ,
thanks for you answer,
Just tried and it didn’t work, there is still a kind of “limit” because I did’n’t have all the attribute’s table populated
ravi
·4 years ago · EditedHi Daphne,
The default limit to search for asset is 1000, just increase the limit.
You can use this:
infoListTable = assetApi.findAssets(FindAssetsRequest.builder()
.typeIds([string2Uuid(tableAssetTypeId)])
.communityId(string2Uuid(technicalAssetCommunity))
.limit(Integer.MAX_VALUE)
.build()
)getResults()
Regards,
Ravi