Retrieving assets¶
I need to do this before I can update an asset, right?
Strictly speaking, no, you do not. And in fact if you ultimately intend to update an asset you should trim it down to only what you intend to change and not send a complete asset. See Updating an asset for more details.
Retrieving an asset uses a slightly different pattern from the other operations. For this you can use static methods provided by the Asset
class:
By GUID¶
To retrieve an asset by its GUID:
Retrieve an asset by its GUID | |
---|---|
1 2 |
|
- If no exception is thrown, the returned object will be non-null and of the type requested.
Compile-time type checking
This operation will type-check the asset you are retrieving is of the type requested. If it is not, you will receive a NotFoundException
, even if the GUID represents some other asset.
Retrieve an asset by its GUID | |
---|---|
1 2 3 4 5 6 7 8 |
|
- Optionally, you can provide the asset type:
- If no exception is thrown, the returned object will be non-null and of the type requested.
Run-time type checking
This operation will type-check the asset you are retrieving is of the type requested. If it is not, you will receive a NotFoundException
, even if the GUID represents some other asset.
Retrieve an asset by its GUID | |
---|---|
1 2 |
|
- If no exception is thrown, the returned object will be non-null and of the type requested.
Compile-time type checking
This operation will type-check the asset you are retrieving is of the type requested. If it is not, you will receive a NotFoundException
, even if the GUID represents some other asset.
GET /api/meta/entity/guid/b4113341-251b-4adc-81fb-2420501c30e6?ignoreRelationships=false&minExtInfo=false | |
---|---|
1 |
|
- In the case of retrieving an asset, all necessary information is included in the URL of the request. There is no payload for the body of the request.
By GUID (runtime typing)¶
To retrieve an asset by GUID, but only resolve the type at runtime:
Retrieve an asset by its GUID | |
---|---|
1 2 3 4 5 6 7 8 |
|
- Retrieve the asset by its GUID. Since GUIDs are globally unique, you do not need to specify a type. (And this is why the operation returns a generic
Asset
, since the SDK can only determine the type at runtime, once it has a response back from Atlan.) - Since the operation returns a generic
Asset
, you need to check and cast it to a more specific type if you want to access the more specific attributes of that type.
Retrieve an asset by its GUID | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
- Since the operation returns a generic
Asset
, you need to useisinstance()
to cast it to a more specific type in the block if you want an IDE to provide more specific type hints.
Retrieve an asset by its GUID | |
---|---|
1 2 3 4 5 |
|
- Retrieve the asset by its GUID. Since GUIDs are globally unique, you do not need to specify a type. (And this is why the operation returns a generic
Asset
, since the SDK can only determine the type at runtime, once it has a response back from Atlan.) - Since the operation returns a generic
Asset
, you need to check and cast it to a more specific type if you want to access the more specific attributes of that type.
Does not apply to a raw API request
There is no concept of typing in a raw API request — all responses to the raw API will simply be JSON objects.
By qualifiedName
¶
To retrieve an asset by its qualifiedName
:
Retrieve an asset by its qualifiedName | |
---|---|
1 2 3 4 |
|
-
If no exception is thrown, the returned object will be non-null and of the type requested.
Qualified name, not name
You must provide the
qualifiedName
for glossary objects (glossaries, categories, terms) to use this method. If you only know the name, you should instead use thefindByName()
operations. -
For most objects, you can probably build-up the
qualifiedName
in your code directly.Finding the connection portion
The one exception is likely to be the connection portion of the name (
default/snowflake/1657037873
in this example). To find this portion, see Find connections.
Retrieve an asset by its qualifiedName | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
- If no exception is thrown, the returned object will be non-null and of the type requested.
-
For most objects, you can probably build-up the
qualified_name
in your code directly.Finding the connection portion
The one exception is likely to be the connection portion of the name (
default/snowflake/1657037873
in this example). To find this portion, see Find connections.
Retrieve an asset by its qualifiedName | |
---|---|
1 2 3 4 |
|
-
If no exception is thrown, the returned object will be non-null and of the type requested.
Qualified name, not name
You must provide the
qualifiedName
for glossary objects (glossaries, categories, terms) to use this method. If you only know the name, you should instead use thefindByName()
operations. -
For most objects, you can probably build-up the
qualifiedName
in your code directly.Finding the connection portion
The one exception is likely to be the connection portion of the name (
default/snowflake/1657037873
in this example). To find this portion, see Find connections.
GET /api/meta/entity/uniqueAttribute/type/Glossary/attr:qualifiedName=FzCMyPR2LxkPFgr8eNGrq&ignoreRelationships=false&minExtInfo=false | |
---|---|
1 |
|
-
In the case of retrieving an asset, all necessary information is included in the URL of the request. There is no payload for the body of the request.
URL encoding may be needed
Note that depending on the qualifiedName, you may need to URL-encode its value before sending. This is to replace any parts of the name that could be misinterpreted as actual URL components (like
/
or spaces).
Full vs minimal assets¶
The examples above illustrate how to retrieve an asset with all of its relationships (a complete asset). You can also retrieve a "minimal" asset that includes only the non-relationship values for the asset:
Retrieve an asset by its GUID | |
---|---|
1 2 3 4 |
|
- Retrieve the minimal asset by its GUID. The last (optional) parameter being false indicates you want to retrieve the asset without its relationships (a minimal asset). Similar variations exist on every asset as well as on the dynamically-typed
Asset
static methods.
Retrieve an asset by its GUID | |
---|---|
1 2 3 4 5 6 7 8 |
|
- Optionally, you can provide the asset type:
- If no exception is thrown, the returned object will be non-null and of the type requested.
Retrieve an asset by its GUID | |
---|---|
1 2 3 4 |
|
- Retrieve the minimal asset by its GUID. The last (optional) parameter being false indicates you want to retrieve the asset without its relationships (a minimal asset). Similar variations exist on every asset as well as on the dynamically-typed
Asset
static methods.
GET /api/meta/entity/guid/b4113341-251b-4adc-81fb-2420501c30e6?ignoreRelationships=true&minExtInfo=true | |
---|---|
1 |
|
- In the case of retrieving an asset, all necessary information is included in the URL of the request. Retrieving a minimal asset is a matter of setting the query parameters
ignoreRelationships
andminExtInfo
totrue
.
Retrieve minimal assets where possible
You should retrieve minimal assets for better performance in cases where you do not need all of the relationships of the asset.
Keep in mind that although the relationships will not be visible in the object after retrieving a minimal asset, this does not mean that there are no relationships on that asset (in Atlan).