Retrieve last row

async AsyncCogniteClient.sequences.data.retrieve_last_row(
id: int | None = None,
external_id: str | None = None,
columns: SequenceNotStr[str] | None = None,
before: int | None = None,
) → SequenceRows

Retrieves the last row (i.e the row with the highest row number) in a sequence.

Deprecated since version 8.23.0: The Sequences API is deprecated and is scheduled for removal on 2027-12-31. Use files in data modeling (for whole-table downloads) or records (for row-level queries). See https://docs.cognite.com/cdf/deprecated for details and migration guidance.

Parameters:
  • id (int | None) – Id or list of ids.

  • external_id (str | None) – External id or list of external ids.

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

  • before (int | None) – (optional, int): Get latest datapoint before this row number.

Returns:

A Datapoints object containing the requested data, or a list of such objects.

Return type:

SequenceRows

Examples

Getting the latest row in a sequence before row number 1000:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.sequences.data.retrieve_last_row(id=1, before=1000)