Create Postgres Gateway Tables

async AsyncCogniteClient.postgres_gateway.tables.create(
username: str,
items: TableWrite | Sequence[TableWrite],
) Table | TableList

Create tables.

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

  • items (pg.TableWrite | Sequence[pg.TableWrite]) – The table(s) to create

Returns:

Created tables

Return type:

pg.Table | pg.TableList

Examples

Create custom table:

>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes.data_modeling import ViewId
>>> from cognite.client.data_classes.postgres_gateway import ViewTableWrite
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> table = ViewTableWrite(
...     tablename="myCustom",
...     options=ViewId(space="mySpace", external_id="myExternalId", version="v1"),
... )
>>> res = client.postgres_gateway.tables.create("myUserName", table)