Find and apply suggestions to an asset¶
As a data team ourselves, we understand that metadata curation can be time-consuming. To streamline this process, each time you fill in a metadata gap, Atlan looks for opportunities to reuse that information.
This is where trident suggestions 🔱 come into play. It provides metadata suggestions for similar assets.
For example: CUSTOMER (table)
You add the description "Information about customers" to a table called CUSTOMER.
-
Atlan searches for other tables named
CUSTOMERthat lack a description. -
Atlan then suggests "Information about customers" as the description for these other
CUSTOMERtables.
In Atlan's SDK, you can use the Suggestions object to
find and apply these recommendations to your assets.
Find suggestions¶
Find suggestions for a given asset:
| Find suggestions for a given asset | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
- First, you need to retrieve the asset for which you want to find suggestions.
-
Start by building a
Suggestionsrequest by chaining the following methods:finder: specify the asset for which you want to find suggestions.-
include: add criteria to specify the types of suggestions to include in the search results. For this example, we're retrieving suggestions forGroupOwnersandUserDescription.Want to find suggestions for ALL types?
To include all suggestion types (
description,owner,tags, andterms):Suggestions.includes(Arrays.asList(Suggestions.TYPE.values())) -
maxSuggestions: (Optional) specify the maximum number of suggestions to return. Defaults to5. includeArchived: (Optional) specify whether to include archived assets in the suggestions (true) or not (false). Defaults tofalse.-
withOtherType: (Optional) add a criterion to include another asset type in the suggestions.withOtherTypeBy default, we will only look for suggestions on assets of the same type. You may want to expand this, for example, by including
View(s) when looking for suggested metadata forTable(s). -
where: (Optional) add a criterion that must be present in every search result. (NOTE: These are translated to filters.) whereNot: (Optional) add a criterion that must not be present in any search result.
-
Finally, to retrieve the suggestions, call the
.get()method. - The suggestion response contains a list of
suggestions for the requested types. You can access
specific suggestions by directly referencing the response attributes,
such as
response.getOwnerGroups()andresponse.getUserDescriptions().
| Find suggestions for a given asset | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
- First, you need to retrieve the asset for which you want to find suggestions.
-
Start by instantiating the
Suggestions()object. You can then build a suggestion request by chaining the following methods:finder: specify the asset for which you want to find suggestions.-
include: add criteria to specify the types of suggestions to include in the search results. For this example, we're retrieving suggestions forGROUP_OWNERSandUSER_DESCRIPTION.Want to find suggestions for ALL types?
To include all suggestion types (
description,owner,tags, andterms), you can directly passSuggestions.TYPE.all()to theSuggestions:Suggestions(includes=Suggestions.TYPE.all()) -
max_suggestion: (Optional) specify the maximum number of suggestions to return. Defaults to5. include_archive: (Optional) specify whether to include archived assets in the suggestions (True) or not (False). Defaults toFalse.-
with_other_type: (Optional) add a criterion to include another asset type in the suggestions.with_other_typeBy default, we will only look for suggestions on assets of the same type. You may want to expand this, for example, by including
View(s) when looking for suggested metadata forTable(s). -
where: (Optional) add a criterion that must be present in every search result. (NOTE: These are translated to filters.) where_not: (Optional) add a criterion that must not be present in any search result.
-
Finally, to retrieve the suggestions, call the
.get()method. - The suggestion response contains a list of
suggestions for the requested types. You can access
specific suggestions by directly referencing the response attributes,
such as
response.owner_groupsandresponse.user_descriptions.
| Find suggestions for a given asset | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
- First, you need to retrieve the asset for which you want to find suggestions.
-
Start by building a
Suggestionsrequest by chaining the following methods:finder: specify the asset for which you want to find suggestions.-
include: add criteria to specify the types of suggestions to include in the search results. For this example, we're retrieving suggestions forGroupOwnersandUserDescription.Want to find suggestions for ALL types?
To include all suggestion types (
description,owner,tags, andterms):Suggestions.includes(Suggestions.TYPE.values().toList()) -
maxSuggestions: (Optional) specify the maximum number of suggestions to return. Defaults to5. includeArchived: (Optional) specify whether to include archived assets in the suggestions (true) or not (false). Defaults tofalse.-
withOtherType: (Optional) add a criterion to include another asset type in the suggestions.withOtherTypeBy default, we will only look for suggestions on assets of the same type. You may want to expand this, for example, by including
View(s) when looking for suggested metadata forTable(s). -
where: (Optional) add a criterion that must be present in every search result. (NOTE: These are translated to filters.) whereNot: (Optional) add a criterion that must not be present in any search result.
-
Finally, to retrieve the suggestions, call the
.get()method. - The suggestion response contains a list of
suggestions for the requested types. You can access
specific suggestions by directly referencing the response attributes,
such as
response.getOwnerGroups()andresponse.getUserDescriptions().
Apply suggestions¶
Apply suggestions to a given asset:
| Apply suggestions to a given asset | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
- First, retrieve the asset for which you want to apply suggestions.
- Start by building
Suggestionsrequest in the same way as described in Find suggestions section, since here we first find the suggestions and then apply them. - To apply the suggestions, call the
.apply()method. Optionally, you can setallowMultipletotrueto allow multiple suggestions to be applied to the asset (up to themaxSuggestionsrequested), such as for owners, terms, and tags. - The
AssetMutationResponsewill contain the updated asset entities.
| Apply suggestions to a given asset | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
- First, retrieve the asset for which you want to apply suggestions.
- Start by instantiating the
Suggestions()object. You can then build a suggestion request in the same way as described in Find suggestions section, since here we first find the suggestions and then apply them. - To apply the suggestions, call the
.apply()method. Optionally, you can setallow_multipletoTrueto allow multiple suggestions to be applied to the asset (up to themax_suggestionsrequested), such as for owners, terms, and tags. - The
AssetMutationResponsewill contain the mutated asset entities.
| Apply suggestions to a given asset | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
- First, retrieve the asset for which you want to apply suggestions.
- Start by building
Suggestionsrequest in the same way as described in Find suggestions section, since here we first find the suggestions and then apply them. - To apply the suggestions, call the
.apply()method. Optionally, you can setallowMultipletotrueto allow multiple suggestions to be applied to the asset (up to themaxSuggestionsrequested), such as for owners, terms, and tags. - The
AssetMutationResponsewill contain the updated asset entities.