Get a row from a table

async AsyncCogniteClient.raw.rows.retrieve(
db_name: str,
table_name: str,
key: str,
) Row | None

Retrieve a single row by key.

Parameters:
  • db_name (str) – Name of the database.

  • table_name (str) – Name of the table.

  • key (str) – The key of the row to retrieve.

Returns:

The requested row.

Return type:

Row | None

Examples

Retrieve a row with key ‘k1’ from table ‘t1’ in database ‘db1’:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> row = client.raw.rows.retrieve("db1", "t1", "k1")

You may access the data directly on the row (like a dict), or use ‘.get’ when keys can be missing:

>>> val1 = row["col1"]
>>> val2 = row.get("col2")