Retrieve a relationship by external id
- async AsyncCogniteClient.relationships.retrieve(
- external_id: str,
- fetch_resources: bool = False,
Retrieve a single relationship by external id.
Deprecated since version 8.23.0: The Relationships API is deprecated and is scheduled for removal on 2027-12-31. Model connections as edges or direct relations in the data modeling service. See https://docs.cognite.com/cdf/deprecated for details and migration guidance.
- 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")