Get all assets that are linked to a specific term¶
This example finds all assets that are linked to a specific glossary term. (And could be extended to do find assets linked to any one of a number of glossary terms.) In this specific example we will find any assets linked to a glossary term named Revenue
in a glossary named Metrics
.
You'll need the qualifiedName of the glossary term
To find the assets linked to the glossary term, you'll need to search using the qualifiedName
of the term. This is not the human-readable name you see in the UI. So this example is split into two parts:
- Finding the
qualifiedName
of the glossary term from its human-readable name and the result of (1). - Finding all assets linked to that glossary term.
For example:
Find qualifiedName of the term | |
---|---|
1 2 |
|
- The
GlossaryTerm.findByName()
helper method will retrieve the glossary term by its human-readable name, given the name of the glossary in which it should exist. If the term does not exist (within that glossary), it will throw aNotFoundException
. - If no exception was thrown, you can retrieve the qualifiedName of the glossary term.
Get all assets linked to a specific term | |
---|---|
3 4 5 6 7 8 9 |
|
- Start with a client to run the search through. For the default client, you can always use
Atlan.getDefaultClient()
. - To search across all assets, you can use the
assets.select()
convenience method on a client. - When searching for assets linked to one or more terms, you need to use the
qualifiedName
of the term(s). (This example shows searching for just one term, but you could search for any number of them in the list. The search will find assets that are assigned at least one of those terms in the list.) - The search will only run when you call the
stream()
method, which will then lazily-load each page of results into a stream. - This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Find qualifiedName of the term | |
---|---|
1 2 3 4 5 6 |
|
- Start with a client to run the search through. For the default client, you can always use
AtlanClient()
. - The
asset.find_term_by_name()
helper method will retrieve the glossary term by its human-readable name, given the name of the glossary in which it should exist. If the term does not exist (within that glossary), it will throw aNotFoundError
. - If no exception was thrown, you can retrieve the
qualified_name
of the glossary term.
Get all assets linked to a specific term | |
---|---|
7 8 9 10 11 12 |
|
- To search across all assets, you can use a
FluentSearch
object. - When searching for assets linked to a given term, you need to use the
qualified_name
of the term. - You can then translate the fluent search into an index search request.
- This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Requires multiple API operations
Before you can search for assets linked to a term, you first need to have the qualifiedName of the term. You will likely need to first find the term by its name.
POST /api/meta/search/indexsearch | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
- Run a search to find the assets.
- For a search with only a single condition, we can directly provide the condition.
- You can use the
terms
query to exactly match a value on assets, for a given field, against a list of possible matches. - To find terms, match against the
__meanings
field. - Provide the exact value of the
qualifiedName
for the term for which you want to find linked assets.