
## Retrieve asset

URL: https://docs.atlan.com/product/capabilities/build-apps/sdks/python/how-tos/asset-crud/retrieve-asset

> Retrieve assets in Atlan by GUID or qualified name using Asset and the Python SDK (pyatlan). Access full or minimal asset representations via GET /api/meta/entity/{guid}.

# Asset: retrieve assets by GUID or qualified name

Use `Asset` in the Atlan Python SDK to programmatically retrieve any asset by its GUID, qualified name, or via search.

> *I need to do this before I can update an asset, right? — see full content on the documentation site.*

Retrieving an [asset](https://docs.atlan.com/llms/platform/python/build-your-first-metadata-workflow/llms.txt) 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:

### Java

```java showLineNumbers title="Retrieve an asset by its GUID"
Business Graph glossary = Business Graph
 .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`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

:::warning[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.
:::

### Python

```python showLineNumbers title="Retrieve an asset by its GUID"
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AtlasBusiness Graph, AtlasGlossaryTerm

client = AtlanClient()
glossary = client.asset.get_by_guid( # (1)
 guid="b4113341-251b-4adc-81fb-2420501c30e6",
 asset_type=AtlasBusiness Graph, 
 min_ext_info=False,
 ignore_relationships=True,
 attributes=[AtlasBusiness Graph.USER_DESCRIPTION, AtlasBusiness Graph.TERMS],
 related_attributes=[AtlasGlossaryTerm.USER_DESCRIPTION]
)

assert glossary and glossary.user_description
assert glossary.terms and len(glossary.terms) > 0
assert glossary.terms[0].user_description 
```

1. `client.asset.get_by_guid()` method takes following parameters:

 - `guid`: specify the (GUID) of the asset to retrieve.
 - `asset_type`(**optional**): specify the type of asset to retrieve. Defaults to `Asset`. If no exception is thrown, the returned object will be non-null and of the type requested.
 - `min_ext_info`(**optional**): minimizes additional information when set to `True`. Defaults to `False`
 - `ignore_relationships`(**optional**): specify whether to include relationships (`False`) or exclude them (`True`). Defaults to `True`
 - `attributes`(**optional**): defines the list of attributes to retrieve for the asset. Accepts either a list of strings or a list of `AtlanField`.
 - `related_attributes`(**optional**): defines the list of relationship attributes to retrieve for the asset. Accepts either a list of strings or a list of `AtlanField`.

 :::note[Attributes and Related attributes]
In this example, we're retrieving the `userDescription` attribute for
both the `glossary` and its `terms`. You can also retrieve other attributes as illustrated above.
 :::
:::warning[Run-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.
:::

### Kotlin

```kotlin showLineNumbers title="Retrieve an asset by its GUID"
val glossary = Business Graph
 .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`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

:::warning[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.
:::

### Raw REST API

```json showLineNumbers title="GET /api/meta/entity/guid/b4113341-251b-4adc-81fb-2420501c30e6?ignoreRelationships=false&minExtInfo=false"
// (1)
```

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:

### Java

```java showLineNumbers title="Retrieve an asset by its GUID"
Asset read = Asset
 .get(client,
 "b4113341-251b-4adc-81fb-2420501c30e6", // (1)
 false);
Business Graph glossary;
if (read instanceof Business Graph)
```

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.

### Python

```python showLineNumbers title="Retrieve an asset by its GUID"
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AtlasBusiness Graph, AtlasGlossaryTerm

client = AtlanClient()
glossary = client.asset.get_by_guid( # (1)
 guid="b4113341-251b-4adc-81fb-2420501c30e6",
 asset_type=AtlasBusiness Graph, 
 min_ext_info=False,
 ignore_relationships=True,
 attributes=[AtlasBusiness Graph.USER_DESCRIPTION, AtlasBusiness Graph.TERMS],
 related_attributes=[AtlasGlossaryTerm.USER_DESCRIPTION]
)
if isinstance(asset, AtlasBusiness Graph): # (2) 
 glossary = asset 
 assert glossary and glossary.user_description
 assert glossary.terms and len(glossary.terms) > 0
 assert glossary.terms[0].user_description
```

1. `client.asset.get_by_guid()` method takes following parameters:

 - `guid`: specify the (GUID) of the asset to retrieve.
 - `asset_type`(**optional**): specify the type of asset to retrieve. Defaults to `Asset`. If no exception is thrown, the returned object will be non-null and of the type requested.
 - `min_ext_info`(**optional**): minimizes additional information when set to `True`. Defaults to `False`
 - `ignore_relationships`(**optional**): specify whether to include relationships (`False`) or exclude them (`True`). Defaults to `True`
 - `attributes`(**optional**): defines the list of attributes to retrieve for the asset. Accepts either a list of strings or a list of `AtlanField`.
 - `related_attributes`(**optional**): defines the list of relationship attributes to retrieve for the asset. Accepts either a list of strings or a list of `AtlanField`.

 :::note[Attributes and Related attributes]
In this example, we're retrieving the `userDescription` attribute for
both the `glossary` and its `terms`. You can also retrieve other attributes as illustrated above.
 :::
2. Since the operation returns a generic `Asset`, you need to use `isinstance()` to cast it to a more specific type in the block if you want an IDE to provide more specific type hints.

### Kotlin

```kotlin showLineNumbers title="Retrieve an asset by its GUID"
val read: Asset = Asset
 .get(client,
 "b4113341-251b-4adc-81fb-2420501c30e6", // (1)
 false)
val glossary = if (read is Business Graph) read else null // (2)
```

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.

### Raw REST API

:::warning[Doesn't 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`:

### Java

```java showLineNumbers title="Retrieve an asset by its qualifiedName"
Business Graph glossary = Business Graph
 .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`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

 :::warning[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()`](https://docs.atlan.com/llms/governance/glossary/retrieve-by-name/llms.txt) 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`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

 :::tip[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](https://docs.atlan.com/llms/platform/python/search-examples/llms.txt).
 :::

### Python

```python showLineNumbers title="Retrieve an asset by its qualifiedName"
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AtlasBusiness Graph, AtlasGlossaryTerm, Table

client = AtlanClient()
glossary = client.asset.get_by_qualified_name( # (1)
 asset_type=AtlasBusiness Graph, 
 qualified_name="pXkf3RUvsIOIG8xnn0W3O",
 min_ext_info=False,
 ignore_relationships=True,
 attributes=[AtlasBusiness Graph.USER_DESCRIPTION, AtlasBusiness Graph.TERMS],
 related_attributes=[AtlasGlossaryTerm.USER_DESCRIPTION]
)

assert glossary and glossary.user_description
assert glossary.terms and len(glossary.terms) > 0
assert glossary.terms[0].user_description 

table = client.asset.get_by_qualified_name(
 asset_type=Table,
 qualified_name="default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS", # (2)
 min_ext_info=False,
 ignore_relationships=True,
 attributes=[Table.USER_DESCRIPTION, Table.COLUMNS],
 related_attributes=[COLUMN.USER_DESCRIPTION]
)

assert table and table.user_description
assert table.columns and len(table.columns) > 0
assert table.columns[0].user_description 
```

1. `client.asset.get_by_qualified_name()` method takes following parameters:

 - `qualified_name`: specify the qualified name of the asset to retrieve.
 - `asset_type`: specify the type of asset to retrieve. If no exception is thrown, the returned object will be non-null and of the type requested.
 - `min_ext_info`(**optional**): minimizes additional information when set to `True`. Defaults to `False`
 - `ignore_relationships`(**optional**): specify whether to include relationships (`False`) or exclude them (`True`). Defaults to `True`
 - `attributes`(**optional**): defines the list of attributes to retrieve for the asset. Accepts either a list of strings or a list of `AtlanField`.
 - `related_attributes`(**optional**): defines the list of relationship attributes to retrieve for the asset. Accepts either a list of strings or a list of `AtlanField`.

 :::note[Attributes and Related attributes]
In this example, we're retrieving the `userDescription` attribute for
both the `glossary` and its `terms`. You can also retrieve other attributes as illustrated above.
 :::
2. For most objects, you can probably build-up the `qualified_name` in your code directly.

 :::tip[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](https://docs.atlan.com/llms/platform/python/search-examples/llms.txt).
 :::

### Kotlin

```kotlin showLineNumbers title="Retrieve an asset by its qualifiedName"
val glossary = Business Graph
 .get(client, "FzCMyPR2LxkPFgr8eNGrq") // (1)
val 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`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

 :::warning[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()`](https://docs.atlan.com/llms/governance/glossary/retrieve-by-name/llms.txt) 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`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

 :::tip[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](https://docs.atlan.com/llms/platform/python/search-examples/llms.txt).
 :::

### Raw REST API

```json showLineNumbers title="GET /api/meta/entity/uniqueAttribute/type/Glossary?attr:qualifiedName=FzCMyPR2LxkPFgr8eNGrq&ignoreRelationships=false&minExtInfo=false"
// (1)
```

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.

 :::warning[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).
- an asset without any of its relationships (a *minimal* asset).

You can also retrieve the opposite by explicitly requesting it:

### Java

```java showLineNumbers title="Retrieve an asset by its GUID"
Business Graph glossary = Business Graph
 .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.

### Python

```python showLineNumbers title="Retrieve an asset by its GUID"
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AtlasBusiness Graph

client = AtlanClient()
glossary = client.asset.retrieve_minimal(
 asset_type=AtlasBusiness Graph, # (1)
 guid="b4113341-251b-4adc-81fb-2420501c30e6"
)
```

1. Optionally, you can provide the asset type:
 - If no exception is thrown, the returned object will be non-null and of the type requested.

### Kotlin

```kotlin showLineNumbers title="Retrieve an asset by its GUID"
val glossary = Business Graph
 .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.

### Raw REST API

```json showLineNumbers title="GET /api/meta/entity/guid/b4113341-251b-4adc-81fb-2420501c30e6?ignoreRelationships=true&minExtInfo=true"
// (1)
```

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` and `minExtInfo` to `true`.

:::tip[Retrieve minimal assets where possible]
You should retrieve minimal assets for better performance in cases where you don't need *all* of the relationships of the asset.

Keep in mind that although the relationships won't be visible in the object after retrieving a minimal asset, this does *not* mean that there are no relationships on that asset (in Atlan).
:::

---
