Retrieve a relationship by external id

async AsyncCogniteClient.relationships.retrieve(
external_id: str,
fetch_resources: bool = False,
) Relationship | None

Retrieve a single relationship by external id.

Parameters:
  • external_id (str) – External ID

  • fetch_resources (bool) – If true, will try to return the full resources referenced by the relationship in the source and target fields.

Returns:

Requested relationship or None if it does not exist.

Return type:

Relationship | None

Examples

Get relationship by external id:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.relationships.retrieve(external_id="1")