Search examples¶
Connection by name and type¶
You may have noticed that connections in Atlan have qualifiedName
s that include a timestamp. As a result, they are not trivial to directly construct.
However, you can search for them by name and type to resolve their qualifiedName
:
Find a connection by name and type | |
---|---|
1 2 3 4 |
|
- Use the
findByName
static method on theConnection
class to search for connections by name and type. If you name your connections uniquely (by type), this should only return a single-item list. - Because this operation will directly search for the asset in Atlan, you must provide it an
AtlanClient
through which to connect to the tenant. - Provide the name of the connection (this will be exact-matched).
- Provide the type of the connection. You can also (optionally) provide a list of extra attributes you want to retrieve for the connection. Core attributes like
qualifiedName
and its GUID are already included.
Find a connection by name and type | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
- Use the
asset.find_connections_by_name
method on theAtlanClient
class to search for connections by name and type. If you name your connections uniquely (by type), this should only return a single-item list. - Provide the name of the connection (this will be exact-matched).
- Provide the type of the connection.
- You can also (optionally) provide a list of extra attributes you want to retrieve for the connection. Core attributes like
qualifiedName
and its GUID are already included.
Find a connection by name and type | |
---|---|
1 2 3 4 |
|
- Use the
findByName
static method on theConnection
class to search for connections by name and type. If you name your connections uniquely (by type), this should only return a single-item list. - Because this operation will directly search for the asset in Atlan, you must provide it an
AtlanClient
through which to connect to the tenant. - Provide the name of the connection (this will be exact-matched).
- Provide the type of the connection. You can also (optionally) provide a list of extra attributes you want to retrieve for the connection. Core attributes like
qualifiedName
and its GUID are already included.
POST /api/meta/search/indexsearch | |
---|---|
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
- Run a search to find the connections.
- To start building up a query with multiple conditions, you can use a
bool
query in Elasticsearch. - You can use the
filter
criteria to define all the conditions the search results must match in a binary way (either matches or doesn't). This avoids the need to calculate a score for each result. - Searches by default will return all assets that are found — whether active or archived (soft-deleted). In most cases, you probably only want the active ones.
- Since there could be tables, views, materialized views, columns, databases, schemas, etc in this connection — but you only want the connection itself — you can use an exact match on the type to restrict results to only connections.
- Exact match search (case-sensitive) on the name of the connection.
- Exact match search on the type of the connector for the connection.
All connections¶
On the other hand, you may want to find all the connections that exist in the environment:
Find all connections | |
---|---|
1 2 3 4 5 6 7 |
|
- To start building up a query to include all connections, you can use the
select()
convenience method onConnection
itself. This will already limit results to only active (non-archived) connections. Because this operation will directly search for the asset in Atlan, you must provide it anAtlanClient
through which to connect to the tenant. - (Optional) You can chain a
pageSize()
method to control the page sizes, to further limit API calls by retrieving more results per page. - The search will only run when you call the
stream()
method, which will then lazily-load each page of results into a stream. - (Optional) You can do any other operations you might do on a stream, such as filtering the results to ensure they are of a certain type.
- This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Find all connections | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
- Start with a client to run the search through. For the default client, you can always use
AtlanClient()
. - To search across all assets, you can use a
FluentSearch
object. - The
.where()
method allows you to limit to only certain assets. In this example, we are looking for connections, so use theCompoundQuery.asset_type()
helper to narrow to only connections. - You can chain additional
.where()
methods to add further conditions, like this example where we limit to only active (non-archived) assets. - (Optional) You can chain a
pageSize()
method to control the page sizes, to further limit API calls by retrieving more results per page. - 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.
- Use the
isinstance
method to ensure that the asset is of the desired type. This will also allow an IDE to provide specific type hints for this asset type.
Find all connections | |
---|---|
1 2 3 4 5 6 7 |
|
- To start building up a query to include all connections, you can use the
select()
convenience method onConnection
itself. This will already limit results to only active (non-archived) connections. Because this operation will directly search for the asset in Atlan, you must provide it anAtlanClient
through which to connect to the tenant. - (Optional) You can chain a
pageSize()
method to control the page sizes, to further limit API calls by retrieving more results per page. - The search will only run when you call the
stream()
method, which will then lazily-load each page of results into a stream. - (Optional) You can do any other operations you might do on a stream, such as filtering the results to ensure they are of a certain type.
- This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
POST /api/meta/search/indexsearch | |
---|---|
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 26 27 28 29 30 31 |
|
-
Run a search to find the connections.
-
To start building up a query with multiple conditions, you can use a
bool
query in Elasticsearch. -
You can use the
filter
criteria to define all the conditions the search results must match in a binary way (either matches or doesn't). This avoids the need to calculate a score for each result. -
You can use an exact match on the type to restrict results to only connections.
-
Searches by default will return all assets that are found — whether active or archived (soft-deleted). In most cases, you probably only want the active ones.
Columns in a schema¶
This example finds all columns that exist in a particular schema — irrespective of the table, view, or materialized view they exist within.
Get all columns in a schema | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
- Part of the trick here is that the
qualifiedName
of a column starts with thequalifiedName
of its parent (table, view or materialized view). Similarly, thequalifiedName
of the table, view or materialized view starts with thequalifiedName
of its parent schema. (And so on, all the way up to the connection itself.) - To start building up a query specifically for columns, you can use the
select()
convenience method onColumn
itself. Because this operation will directly search for the asset in Atlan, you must provide it anAtlanClient
through which to connect to the tenant. - You can use the
where()
method to define all the conditions the search results must match. For this example, use theAsset.QUALIFIED_NAME
constant to limit to only those assets whosequalifiedName
starts with thequalifiedName
of the schema (by using thestartsWith()
predicate). In this example, that means only assets that are within this particular schema will be returned as results. - (Optional) You can play around with different page sizes, to further limit API calls by retrieving more results per page.
- Add as many attributes as needed. Each attribute you add here will ensure that detail is included in each search result. So in this example, every column will include its description. (Limit these attributes to the minimum you need about each column to do your intended work.)
- The search will only run when you call the
stream()
method, which will then lazily-load each page of results into a stream. - (Optional) You can do any other operations you might do on a stream, such as filtering the results to ensure they are of a certain type.
- This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Get all columns in a schema | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
- Part of the trick here is that the
qualified_name
of a column starts with thequalified_name
of its parent (table, view or materialized view). Similarly, thequalified_name
of the table, view or materialized view starts with thequalified_name
of its parent schema. (And so on, all the way up to the connection itself.) - Start with a client to run the search through. For the default client, you can always use
AtlanClient()
. - To search across all assets, you can use a
FluentSearch
object. - The
.where()
method allows you to limit to only certain assets. In this example, we are looking for columns, so use theCompoundQuery.asset_type()
helper to narrow to only columns. - You can chain additional
.where()
methods to add further conditions, like this example where we limit to only active (non-archived) assets. - For this example, use the
Column.QUALIFIED_NAME
constant to limit to only those columns whosequalified_name
starts with thequalified_name
of the schema (by using thestartswith()
predicate). In this example, that means only columns that are within this particular schema will be returned as results. - 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.
- Use the
isinstance
method to ensure that the asset is of the desired type. This will also allow an IDE to provide specific type hints for this asset type.
Get all columns in a schema | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
- Part of the trick here is that the
qualifiedName
of a column starts with thequalifiedName
of its parent (table, view or materialized view). Similarly, thequalifiedName
of the table, view or materialized view starts with thequalifiedName
of its parent schema. (And so on, all the way up to the connection itself.) - To start building up a query specifically for columns, you can use the
select()
convenience method onColumn
itself. Because this operation will directly search for the asset in Atlan, you must provide it anAtlanClient
through which to connect to the tenant. - You can use the
where()
method to define all the conditions the search results must match. For this example, use theAsset.QUALIFIED_NAME
constant to limit to only those assets whosequalifiedName
starts with thequalifiedName
of the schema (by using thestartsWith()
predicate). In this example, that means only assets that are within this particular schema will be returned as results. - (Optional) You can play around with different page sizes, to further limit API calls by retrieving more results per page.
- Add as many attributes as needed. Each attribute you add here will ensure that detail is included in each search result. So in this example, every column will include its description. (Limit these attributes to the minimum you need about each column to do your intended work.)
- The search will only run when you call the
stream()
method, which will then lazily-load each page of results into a stream. - (Optional) You can do any other operations you might do on a stream, such as filtering the results to ensure they are of a certain type.
- This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
POST /api/meta/search/indexsearch | |
---|---|
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
-
Run a search to find the columns.
-
To start building up a query with multiple conditions, you can use a
bool
query in Elasticsearch. -
You can use the
filter
criteria to define all the conditions the search results must match in a binary way (either matches or doesn't). This avoids the need to calculate a score for each result. -
Part of the trick here is that the
qualifiedName
of a column starts with thequalifiedName
of its parent (table, view or materialized view). Similarly, thequalifiedName
of the table, view or materialized view starts with thequalifiedName
of its parent schema. (And so on, all the way up to the connection itself.) -
Since there could be tables, views, materialized views and columns in this schema — but you only want columns — you can use an exact match on the type to restrict results to only columns.
-
Searches by default will return all assets that are found — whether active or archived (soft-deleted). In most cases, you probably only want the active ones.
-
Here you can play around with different page sizes, to further limit API calls by retrieving more results per page.
-
Add as many attributes as needed. Each attribute you add here will ensure that detail is included in each search result. So in this example, every column will include its description. (Limit these attributes to the minimum you need about each column to do your intended work.)
Assets with custom metadata¶
This example finds all assets with a particular custom metadata attribute populated — irrespective of the specific value of the attribute.
Get all assets with a custom metadata attribute populated | |
---|---|
1 2 3 4 5 6 7 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. -
When searching for custom metadata attributes, you can construct a
CustomMetadataField
to start a clause that will match a custom metadata property. Since you are searching for the custom metadata attribute itself, there is no enum for the custom metadata or its property names, so these must be provided as strings. (TheCustomMetadataField
will handle translating these from their human-readable values to the Atlan-internal ID strings needed for the search.)The
hasAnyValue()
predicate allows you to limit to assets that have any value for this custom metadata attribute. -
Since you are searching for custom metadata, you probably want to include the values for custom metadata in each search result. This
getAttributesForSearchResults()
helper method will return all of the custom attributes within theRACI
custom metadata structure. These will be encoded in the specific form required by the search for you.Note the use of
_includesOnResults
Since the
getAttributesForSearchResults()
helper will return a list of strings, you'll need to use the special_includesOnResults()
method to add these for inclusion. -
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.
Get all assets with a custom metadata attribute populated | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
- Start with a client to run the search through. For the default client, you can always use
AtlanClient()
. -
To search across all assets, you can use a
FluentSearch
object.Since you are searching for custom metadata, you probably want to include the values for custom metadata in each search result. This
get_attributes_for_search_results()
helper method will return all of the custom attributes within theRACI
custom metadata structure. These will be encoded in the specific form required by the search for you.Note the use of
_includes_on_results
Since the
get_attributes_for_search_results()
helper will return a list of strings, you'll need to use the special_includes_on_results
parameter to add these for inclusion. -
When searching for custom metadata attributes, you can construct a
CustomMetadataField
to start a clause that will match a custom metadata property. Since you are searching for the custom metadata attribute itself, there is no enum for the custom metadata or its property names, so these must be provided as strings. (TheCustomMetadataField
will handle translating these from their human-readable values to the Atlan-internal ID strings needed for the search.)The
has_any_value()
predicate allows you to limit to assets that have any value for this custom metadata attribute. -
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.
Get all assets with a custom metadata attribute populated | |
---|---|
1 2 3 4 5 6 7 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. -
When searching for custom metadata attributes, you can construct a
CustomMetadataField
to start a clause that will match a custom metadata property. Since you are searching for the custom metadata attribute itself, there is no enum for the custom metadata or its property names, so these must be provided as strings. (TheCustomMetadataField
will handle translating these from their human-readable values to the Atlan-internal ID strings needed for the search.)The
hasAnyValue()
predicate allows you to limit to assets that have any value for this custom metadata attribute. -
Since you are searching for custom metadata, you probably want to include the values for custom metadata in each search result. This
getAttributesForSearchResults()
helper method will return all of the custom attributes within theRACI
custom metadata structure. These will be encoded in the specific form required by the search for you.Note the use of
_includesOnResults
Since the
getAttributesForSearchResults()
helper will return a list of strings, you'll need to use the special_includesOnResults()
method to add these for inclusion. -
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.
Requires multiple API operations
Before you can search for custom metadata, you first need to have the Atlan-internal hashed-string representation of the custom metadata property. You will likely need to first retrieve the hashed-string representation.
POST /api/meta/search/indexsearch | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
- 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
exists
criteria to match any assets that have some value (no matter what that value is) for a given field. - Use the Atlan-internal hashed-string representation of the custom metadata field name.
- Include the Atlan-internal hashed-string representation of the custom metadata field name in the attributes list, so you can see the value of the custom metadata on each result. In this attributes list it needs to be written as
<CustomMetadata>.<Attribute>
, using the hashed-string representation for both pieces.
Assets with specific custom metadata value¶
This example finds all assets with a particular custom metadata attribute populated — with a specific value for the attribute.
Get all assets with a specific custom metadata attribute value | |
---|---|
1 2 3 4 5 6 7 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. -
When searching for custom metadata attributes, you can construct a
CustomMetadataField
to start a clause that will match a custom metadata property. Since you are searching for the custom metadata attribute itself, there is no enum for the custom metadata or its property names, so these must be provided as strings. (TheCustomMetadataField
will handle translating these from their human-readable values to the Atlan-internal ID strings needed for the search.)The
eq()
predicate allows you to limit to assets that have only the exact value provided for this custom metadata attribute (and in the case of a string value, you must supply a second parameter indicating whether the search should be case-sensitive (false) or case-insensitive (true)). -
Since you are searching for custom metadata, you probably want to include the values for custom metadata in each search result. This
getAttributesForSearchResults()
helper method will return all of the custom attributes within theRACI
custom metadata structure. These will be encoded in the specific form required by the search for you.Note the use of
_includesOnResults
Since the
getAttributesForSearchResults()
helper will return a list of strings, you'll need to use the special_includesOnResults()
method to add these for inclusion. -
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.
Get all assets with a custom metadata attribute populated | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
- Start with a client to run the search through. For the default client, you can always use
AtlanClient()
. -
To search across all assets, you can use a
FluentSearch
object.Since you are searching for custom metadata, you probably want to include the values for custom metadata in each search result. This
get_attributes_for_search_results()
helper method will return all of the custom attributes within theRACI
custom metadata structure. These will be encoded in the specific form required by the search for you.Note the use of
_includes_on_results
Since the
get_attributes_for_search_results()
helper will return a list of strings, you'll need to use the special_includes_on_results
parameter to add these for inclusion. -
When searching for custom metadata attributes, you can construct a
CustomMetadataField
to start a clause that will match a custom metadata property. Since you are searching for the custom metadata attribute itself, there is no enum for the custom metadata or its property names, so these must be provided as strings. (TheCustomMetadataField
will handle translating these from their human-readable values to the Atlan-internal ID strings needed for the search.)The
eq()
predicate allows you to limit to assets that have only the exact value provided for this custom metadata attribute. -
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.
Get all assets with a specific custom metadata attribute value | |
---|---|
1 2 3 4 5 6 7 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. -
When searching for custom metadata attributes, you can construct a
CustomMetadataField
to start a clause that will match a custom metadata property. Since you are searching for the custom metadata attribute itself, there is no enum for the custom metadata or its property names, so these must be provided as strings. (TheCustomMetadataField
will handle translating these from their human-readable values to the Atlan-internal ID strings needed for the search.)The
eq()
predicate allows you to limit to assets that have only the exact value provided for this custom metadata attribute (and in the case of a string value, you must supply a second parameter indicating whether the search should be case-sensitive (false) or case-insensitive (true)). -
Since you are searching for custom metadata, you probably want to include the values for custom metadata in each search result. This
getAttributesForSearchResults()
helper method will return all of the custom attributes within theRACI
custom metadata structure. These will be encoded in the specific form required by the search for you.Note the use of
_includesOnResults
Since the
getAttributesForSearchResults()
helper will return a list of strings, you'll need to use the special_includesOnResults()
method to add these for inclusion. -
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.
Requires multiple API operations
Before you can search for custom metadata, you first need to have the Atlan-internal hashed-string representation of the custom metadata property. You will likely need to first retrieve the hashed-string representation.
POST /api/meta/search/indexsearch | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
- 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
term
query to exactly match a value on assets, for a given field. - Use the Atlan-internal hashed-string representation of the custom metadata field name.
- Provide the exact value you want to match in that custom metadata property.
- Include the Atlan-internal hashed-string representation of the custom metadata field name in the attributes list, so you can see the value of the custom metadata on each result. In this attributes list it needs to be written as
<CustomMetadata>.<Attribute>
, using the hashed-string representation for both pieces.
Assets linked to a 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
. Because this operation will directly search for the asset in Atlan, you must provide it anAtlanClient
through which to connect to the tenant. - 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 |
|
- 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.
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
. Because this operation will directly search for the asset in Atlan, you must provide it anAtlanClient
through which to connect to the tenant. - 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 |
|
- 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.
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.
Assets with an Atlan tag¶
This example finds all assets that are assigned a specific Atlan tag — irrespective of whether they were directly assigned the tag or it was propagated.
Get all assets with a specific tag | |
---|---|
1 2 3 4 5 6 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. - The
.tagged()
helper method allows us to limit to assets that match at least one of potentially multiple values (since there could be many tags on an asset). The SDK will translate the provided Atlan tag into the necessary internal representation required for the search — you can just provide the human-readable names of the Atlan tags. - 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.
Get all assets with a specific tag | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
- Start with a client to run the search through. For the default client, you can always use
AtlanClient()
. - To search across all assets, you can use a
FluentSearch
object. - The
CompoundQuery.tagged()
helper method allows us to limit to assets that match at least one of potentially multiple values (since there could be many tags on an asset). The SDK will translate the provided Atlan tag into the necessary internal representation required for the search — you can just provide the human-readable names of the Atlan tags. - 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.
Get all assets with a specific tag | |
---|---|
1 2 3 4 5 6 |
|
- 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. - The
.tagged()
helper method allows us to limit to assets that match at least one of potentially multiple values (since there could be many tags on an asset). The SDK will translate the provided Atlan tag into the necessary internal representation required for the search — you can just provide the human-readable names of the Atlan tags. - 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.
Requires multiple API operations
Before you can search for Atlan tags, you first need to have the Atlan-internal hashed-string representation of the tags. You will likely need to first retrieve the hashed-string representation.
POST /api/meta/search/indexsearch | |
---|---|
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 26 27 28 29 30 |
|
- Run a search to find the assets.
- To match both assets that are directly assigned the Atlan tag and those that were propagated the Atlan tag, use a
bool
query for multiple conditions. - Define the minimum number of conditions that need to match on an asset to be included in the results. In this example, you want either a direct or propagated Atlan tag, so should match at least one of the conditions provided.
- Use
__traitNames
to match directly-classified assets. - Use the Atlan-internal hashed-string representation of the Atlan tag.
- Use
__propagatedTraitNames
to match assets that have been propagated this Atlan tag. - Once again, use the Atlan-internal hashed-string representation of the Atlan tag.
Assets with a source tag¶
This example finds all assets that are assigned a specific source tag.
Get all assets with a specific tag | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. - The
.taggedWithValue()
helper method allows us to limit to assets that match having this particular tag and value combination. - You must specify the human-readable name of the Atlan tag that is mapped to a source tag. The SDK will translate the provided Atlan tag into the necessary internal representation required for the search — you can just provide the human-readable names of the Atlan tags.
- You must also provide the value you want to match.
- (Optional) You can restrict the search to only directly-tagged assets with the value using
true
, or look for all assets tagged with the value (whether directly or propagated). - 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.
Get all assets with a specific tag | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
- Start with a client to run the search through.
- To search across all active assets, you can use the
FluentSearch.select()
method. - The
CompoundQuery.tagged_with_value()
helper method allows us to limit to assets that match having this particular tag and value combination. - You must specify the human-readable name of the Atlan tag that is mapped to a source tag. The SDK will translate the provided Atlan tag into the necessary internal representation required for the search — you can just provide the human-readable names of the Atlan tags.
- You must also provide the value you want to match.
- (Optional) You can restrict the search to only directly-tagged assets
with the value using
True
, or look for all assets tagged with the value (whether directly or propagated) (False
). - Now convert the given
FluentSearch
into anIndexSearchRequest
object for the search. - The search will only run when you call the
client.asset.search()
method. - This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Get all assets with a specific tag | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. - The
.taggedWithValue()
helper method allows us to limit to assets that match having this particular tag and value combination. - You must specify the human-readable name of the Atlan tag that is mapped to a source tag. The SDK will translate the provided Atlan tag into the necessary internal representation required for the search — you can just provide the human-readable names of the Atlan tags.
- You must also provide the value you want to match.
- (Optional) You can restrict the search to only directly-tagged assets with the value using
true
, or look for all assets tagged with the value (whether directly or propagated). - 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.
Requires multiple API operations
Before you can search for Atlan tags, you first need to have the Atlan-internal hashed-string representation of the tags. You will likely need to first retrieve the hashed-string representation.
POST /api/meta/search/indexsearch | |
---|---|
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
- Run a search to find the assets.
- To match assets that are directly assigned the Atlan tag, use a
bool
query for multiple conditions. - Use
__traitNames
to match directly-classified assets. - Use the Atlan-internal hashed-string representation of the Atlan tag.
- To match a source tag, you must use a
span_within
query that has this exact structure. - Once again, everywhere you specify the Atlan tag you must use the Atlan-internal hashed-string representation of the Atlan tag.
- You must also specify the
qualifiedName
of the source Tag asset. - When matching a value, you must specify these
little.span_near
clauses in exactly the order shown in this example, starting withtagAttachmentValue
. - The value itself should come next, but note that if there are any spaces in the value then you must specify a
span_term
for each individual word of the value. - Finally you must specify a
span_term
oftagAttachmentKey
as the final clause.
Deprecated assets¶
This example finds all assets that are marked as deprecated.
Get all deprecated assets | |
---|---|
1 2 3 4 5 6 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. -
The
.where()
method allows you to limit to only assets that have a particular value in a particular field. In this example, we are looking for values for the certificate status, so useAsset.CERTIFICATE_STATUS
.Since we only want assets that are deprecated, we will query where that certificate is set to the
CertificateStatus.DEPRECATED
value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.) -
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.
Get all deprecated assets | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
- Start with a client to run the search through. For the default client, you can always use
AtlanClient()
. - To search across all assets, you can use a
FluentSearch
object. -
The
.where()
method allows you to limit to only assets that have a particular value in a particular field. In this example, we are looking for values for the certificate status, so useAsset.CERTIFICATE_STATUS
.Since we only want assets that are deprecated, we will query where that certificate is set to the
CertificateStatus.DEPRECATED
value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.) -
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.
Get all deprecated assets | |
---|---|
1 2 3 4 5 6 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. -
The
.where()
method allows you to limit to only assets that have a particular value in a particular field. In this example, we are looking for values for the certificate status, so useAsset.CERTIFICATE_STATUS
.Since we only want assets that are deprecated, we will query where that certificate is set to the
CertificateStatus.DEPRECATED
value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.) -
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.
Requires multiple API operations
Before you can search for classifications, you first need to have the Atlan-internal hashed-string representation of the classification. You will likely need to first retrieve the hashed-string representation.
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
term
query to exactly match a value on assets, for a given field. - Use the name of the field you want to match. In this example, since you want to match a specific certificate, you can use the
certificateStatus
field. - Provide the exact value you want to match in that field. In this example, you will be matching only assets with a certificate of
DEPRECATED
.
Certified but incomplete assets¶
This example finds all assets that are marked as verified, but are missing a description — suggesting they are in fact incomplete.
Get all verified assets that have no description | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. -
The
where()
helper method allows us to limit to only assets that meet a a particular condition. In this example, we are looking for values for the certificate status, so useAsset.CERTIFICATE_STATUS
. (No need to try to remember or ever even know what the precise string value is for the name of this field — we've provided enums for them in the SDK.)Since we only want assets that are verified, we will query where that certificate is set to the
CertificateStatus.VERIFIED
value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.) -
You can use the
whereNot()
method to do the opposite — define all the conditions the search results must not match. Here we are limiting to only assets that have a description populated.The
hasAnyValue()
predicate method allows us to limit to only assets that have a user-defined description populated. In Atlan you have bothdescription
(crawled from source) anduserDescription
(user-defined or overridden). For this example use case, you probably want to check that both of these are empty. -
As part of the search, you may want certain details included in every result. In this use case, you may want to know the asset owner — someone to confirm this should really be certified when there is no description.
- In Atlan you have both users and groups that can own assets. For this example use case, you probably want to retrieve both of these for every result.
- 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.
Get all verified assets that have no description | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
- Start with a client to run the search through. For the default client, you can always use
AtlanClient()
. - To search across all assets, you can use a
FluentSearch
object. -
The
.where()
method allows you to limit to only assets that have a particular value in a particular field. In this example, we are looking for values for the certificate status, so useAsset.CERTIFICATE_STATUS
.Since we only want assets that are verified, we will query where that certificate is set to the
CertificateStatus.VERIFIED
value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.) -
You can use the
.where_not()
method to do the opposite — define all the conditions the search results must not match. Here we are limiting to only assets that have a description populated.The
has_any_value()
predicate method allows us to limit to only assets that have a user-defined description populated. In Atlan you have bothdescription
(crawled from source) anduserDescription
(user-defined or overridden). For this example use case, you probably want to check that both of these are empty. -
As part of the search, you may want certain details included in every result. In this use case, you may want to know the asset owner — someone to confirm this should really be certified when there is no description.
- In Atlan you have both users and groups that can own assets. For this example use case, you probably want to retrieve both of these for every result.
- 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.
Get all verified assets that have no description | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
- To search across all assets, you can use the
assets.select()
convenience method on a client. -
The
where()
helper method allows us to limit to only assets that meet a a particular condition. In this example, we are looking for values for the certificate status, so useAsset.CERTIFICATE_STATUS
. (No need to try to remember or ever even know what the precise string value is for the name of this field — we've provided enums for them in the SDK.)Since we only want assets that are verified, we will query where that certificate is set to the
CertificateStatus.VERIFIED
value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.) -
You can use the
whereNot()
method to do the opposite — define all the conditions the search results must not match. Here we are limiting to only assets that have a description populated.The
hasAnyValue()
predicate method allows us to limit to only assets that have a user-defined description populated. In Atlan you have bothdescription
(crawled from source) anduserDescription
(user-defined or overridden). For this example use case, you probably want to check that both of these are empty. -
As part of the search, you may want certain details included in every result. In this use case, you may want to know the asset owner — someone to confirm this should really be certified when there is no description.
- In Atlan you have both users and groups that can own assets. For this example use case, you probably want to retrieve both of these for every result.
- 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.
POST /api/meta/search/indexsearch | |
---|---|
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 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
-
Run a search to find the columns.
-
To start building up a query with multiple conditions, you can use a
bool
query in Elasticsearch. -
You can use the
filter
criteria to define all the conditions the search results must match in a binary way (either matches or doesn't). This avoids the need to calculate a score for each result. -
In this example, you are looking for verified assets. So you can begin by filtering only those assets with a
certificateStatus
ofVERIFIED
. -
Since you want to find assets that specifically do not have other characteristics, use the
must_not
criteria to specify these. Specifically, match assets that do not have either adescription
oruserDescription
populated. -
As part of the search, you may want certain details included in every result. In this use case, you may want to know the asset owner — someone to confirm this should really be certified when there is no description.
Where did
ownerUsers
come from?The Models section of the site details all the attributes that exist in each different type of asset, and therefore which ones you can retrieve as additional details in each search result, like
ownerUsers
. -
In Atlan you have both users and groups that can own assets. For this example use case, you probably want to retrieve both of these for every result.
Where did
ownerGroups
come from?The Models section of the site details all the attributes that exist in each different type of asset, and therefore which ones you can retrieve as additional details in each search result, like
ownerGroups
.