Retrieve rows

async AsyncCogniteClient.sequences.data.retrieve(
external_id: str | SequenceNotStr[str] | None = None,
id: int | Sequence[int] | None = None,
start: int = 0,
end: int | None = None,
columns: SequenceNotStr[str] | None = None,
limit: int | None = None,
) SequenceRows | SequenceRowsList

Retrieve data from a sequence.

Parameters:
  • external_id (str | SequenceNotStr[str] | None) – The external id of the sequence to retrieve from.

  • id (int | Sequence[int] | None) – The internal if the sequence to retrieve from.

  • start (int) – Row number to start from (inclusive).

  • end (int | None) – Upper limit on the row number (exclusive). Set to None or -1 to get all rows until end of sequence.

  • columns (SequenceNotStr[str] | None) – List of external id for the columns of the sequence. If ‘None’ is passed, all columns will be retrieved.

  • limit (int | None) – Maximum number of rows to return per sequence. Pass None to fetch all (possibly limited by ‘end’).

Returns:

SequenceRows if a single identifier was given, else SequenceRowsList

Return type:

SequenceRows | SequenceRowsList

Examples

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.sequences.data.retrieve(id=1)
>>> tuples = [
...     (r, v) for r, v in res.items()
... ]  # You can use this iterator in for loops and list comprehensions,
>>> single_value = res[23]  # ... get the values at a single row number,
>>> col = res.get_column(
...     external_id="columnExtId"
... )  # ... get the array of values for a specific column,
>>> df = res.to_pandas()  # ... or convert the result to a dataframe