Retrieve a data set by id

async AsyncCogniteClient.data_sets.retrieve(
id: int | None = None,
external_id: str | None = None,
) → DataSet | None

Retrieve a single data set by id.

Deprecated since version 8.23.0: The Data Sets API is deprecated and is scheduled for removal on 2027-12-31. Scope data with spaces and govern consumption with data products. See https://docs.cognite.com/cdf/deprecated for details and migration guidance.

Parameters:
  • id (int | None) – ID

  • external_id (str | None) – External ID

Returns:

Requested data set or None if it does not exist.

Return type:

DataSet | None

Examples

Get data set by id:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.data_sets.retrieve(id=1)

Get data set by external id:

>>> res = client.data_sets.retrieve(external_id="1")