Retrieve Postgres Gateway Tables

async AsyncCogniteClient.postgres_gateway.tables.retrieve(
username: str,
tablename: str | SequenceNotStr[str],
ignore_unknown_ids: bool = False,
) Table | TableList | None

Retrieve a list of tables by their tables names.

Retrieve a list of Postgres tables for a user by their table names, optionally ignoring unknown table names

Parameters:
  • username (str) – The username (a.k.a. database) to be managed from the API

  • tablename (str | SequenceNotStr[str]) – The name of the table(s) to be retrieved

  • ignore_unknown_ids (bool) – Ignore table names not found

Returns:

Foreign tables

Return type:

pg.Table | pg.TableList | None

Examples

Retrieve custom table:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.postgres_gateway.tables.retrieve("myUserName", "myCustom")

Get multiple custom tables by id:

>>> res = client.postgres_gateway.tables.retrieve(
...     "myUserName", ["myCustom", "myCustom2"]
... )