Skip to main content

Retrieving assets

I need to do this before I can update an asset, right?

Strictly speaking, no, you don't. 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
Glossary glossary = Glossary
.get(client, "b4113341-251b-4adc-81fb-2420501c30e6"); // (1)
  1. If no exception is thrown, the returned object will be non-null and of the type requested. Because this operation will read the asset from Atlan, you must provide it an AtlanClient through which to connect to the tenant.
Compile-time type checking

This operation will type-check the asset you are retrieving is of the type requested. If it'sn't, you will receive a NotFoundException, even if the GUID represents some other asset.

By GUID (runtime typing)

To retrieve an asset by GUID, but only resolve the type at runtime:

Retrieve an asset by its GUID
Asset read = Asset
.get(client,
"b4113341-251b-4adc-81fb-2420501c30e6", // (1)
false);
Glossary glossary;
if (read instanceof Glossary)
  1. Retrieve the asset by its GUID. Since GUIDs are globally unique, you don't 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.)
  2. 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.

By qualifiedName

To retrieve an asset by its qualifiedName:

Retrieve an asset by its qualifiedName
Glossary glossary = Glossary
.get(client, "FzCMyPR2LxkPFgr8eNGrq"); // (1)
Table table = Table
.get(client, "default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS"); // (2)
  1. If no exception is thrown, the returned object will be non-null and of the type requested. Because this operation will read the asset from Atlan, you must provide it an AtlanClient through which to connect to the tenant.

    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 the findByName() operations. ::: 2. For most objects, you can probably build-up the qualifiedName in your code directly. Because this operation will read the asset from Atlan, you must provide it an AtlanClient through which to connect to the tenant.

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.

Full vs minimal assets

The examples above illustrate how to retrieve:

  • an asset with all of its relationships (a complete asset).
  • an asset without any of its relationships (a minimal asset).

You can also retrieve the opposite by explicitly requesting it:

Retrieve an asset by its GUID
Glossary glossary = Glossary
.get(client,
"b4113341-251b-4adc-81fb-2420501c30e6",
true); // (1)
  1. Retrieve the full asset, with all of its relationships, by its GUID. The last (optional) parameter being true indicates you want to retrieve the asset with all its relationships (a "full" asset). Similar variations exist on every asset as well as on the dynamically-typed Asset static methods.
Was this page helpful?