Postgres Gateway

Postgres Gateway Users API

AsyncCogniteClient.postgres_gateway.users.create(user)

Create Users.

AsyncCogniteClient.postgres_gateway.users.delete(...)

Delete postgres user(s).

AsyncCogniteClient.postgres_gateway.users.list([limit])

Fetch scoped users.

AsyncCogniteClient.postgres_gateway.users.retrieve(...)

Retrieve a list of users by their usernames.

AsyncCogniteClient.postgres_gateway.users.update(items)

Update users.

Postgres Gateway Tables API

AsyncCogniteClient.postgres_gateway.tables.create(...)

Create tables.

AsyncCogniteClient.postgres_gateway.tables.delete(...)

Delete postgres table(s).

AsyncCogniteClient.postgres_gateway.tables.list(...)

List postgres tables.

AsyncCogniteClient.postgres_gateway.tables.retrieve(...)

Retrieve a list of tables by their tables names.

Postgres Gateway classes

class cognite.client.data_classes.postgres_gateway.Column(name: 'str', type: 'ColumnType')

Bases: CogniteResource

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.postgres_gateway.ColumnList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[Column]

class cognite.client.data_classes.postgres_gateway.RawTable(
tablename: str,
options: RawTableOptions,
columns: ColumnList,
created_time: int | None = None,
)

Bases: Table

Foreign tables.

This is the read/response format of the raw table.

Parameters:
  • tablename (str) – Name of the foreign table.

  • options (RawTableOptions) – Table options

  • columns (ColumnList) – Foreign table columns.

  • created_time (int | None) – Time when the table was created.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.postgres_gateway.RawTableOptions(database: 'str', table: 'str', primary_key: 'str | None' = None)

Bases: CogniteResource

class cognite.client.data_classes.postgres_gateway.RawTableWrite(
tablename: str,
options: RawTableOptions,
columns: Sequence[Column] | ColumnList,
)

Bases: TableWrite

Foreign tables.

This is the read/response format of the raw table.

Parameters:
  • tablename (str) – Name of the foreign table.

  • options (RawTableOptions) – Table options

  • columns (Sequence[Column] | ColumnList) – Foreign table columns.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.postgres_gateway.SessionCredentials(nonce: 'str')

Bases: CogniteResource

class cognite.client.data_classes.postgres_gateway.Table(tablename: str, created_time: int | None = None)

Bases: _TableCore, ABC

Foreign tables.

This is the read/response format of the custom table.

Parameters:
  • tablename (str) – Name of the foreign table.

  • created_time (int | None) – Time when the table was created

class cognite.client.data_classes.postgres_gateway.TableList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[TableWrite, Table]

class cognite.client.data_classes.postgres_gateway.TableWrite(tablename: str)

Bases: _TableCore, ABC

View and create foreign tables for a given user.

This is the write/request format of the table.

class cognite.client.data_classes.postgres_gateway.TableWriteList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[TableWrite]

class cognite.client.data_classes.postgres_gateway.User(
username: str,
created_time: int,
last_updated_time: int,
session_id: int | None = None,
)

Bases: _UserCore

A user.

This is the read/response format of the user for list and retrieve endpoints.

Parameters:
  • username (str) – Username to authenticate the user on the DB.

  • created_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • last_updated_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • session_id (int | None) – ID of the session tied to this user.

class cognite.client.data_classes.postgres_gateway.UserCreated(
host: str,
username: str,
password: str,
created_time: int,
last_updated_time: int,
session_id: int | None = None,
)

Bases: User

A user.

This is the read/response format of the user for the create endpoint

Parameters:
  • host (str) – Host of the DB.

  • username (str) – Username to authenticate the user on the DB.

  • password (str) – Password to authenticate the user on the DB.

  • created_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • last_updated_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • session_id (int | None) – ID of the session tied to this user.

class cognite.client.data_classes.postgres_gateway.UserCreatedList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[UserWrite, UserCreated]

class cognite.client.data_classes.postgres_gateway.UserList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[UserWrite, User]

class cognite.client.data_classes.postgres_gateway.UserWrite(
credentials: SessionCredentials | None = None,
)

Bases: _UserCore

A postgres gateway user (also a typical postgres user) owns the foreign tables (built in or custom).

The created postgres user only has access to use foreign tables and cannot directly create tables users. To create foreign tables use the Postgres Gateway Tables APIs

This is the write/request format of the user.

Parameters:

credentials (SessionCredentials | None) – Credentials for authenticating towards CDF using a CDF session.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.postgres_gateway.UserWriteList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[UserWrite]

class cognite.client.data_classes.postgres_gateway.ViewTable(
tablename: str,
options: ViewId,
created_time: int | None = None,
)

Bases: Table

Foreign tables.

This is the read/response format of the custom table.

Parameters:
  • tablename (str) – Name of the foreign table.

  • options (ViewId) – Table options

  • created_time (int | None) – Time when the table was created.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.postgres_gateway.ViewTableWrite(
tablename: str,
options: ViewId,
)

Bases: TableWrite

Foreign tables.

This is the read/response format of the custom table.

Parameters:
  • tablename (str) – Name of the foreign table.

  • options (ViewId) – Table options

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]