Table

class beneath.Table[source]

Represents a data-plane connection to a table. To find or create a table, see beneath.Client.

Use it to get a TableInstance, which you can query, replay, subscribe and write to. Learn more about tables and instances at https://about.beneath.dev/docs/concepts/tables/.

use_log: bool

Whether log queries are supported for this table.

use_index: bool

Whether index queries are supported for this table.

use_warehouse: bool

Whether warehouse queries are supported for this table.

table_id: uuid.UUID

The table ID

schema: Schema

The table’s schema

primary_instance: TableInstance

The current primary table instance. This is probably the object you will use to write/query the table.

async find_instances()Iterable[beneath.instance.TableInstance][source]

Returns a list of all the table’s instances. Learn more about instances at https://about.beneath.dev/docs/concepts/tables/.

async find_instance(version: int)[source]

Finds an instance by version number Learn more about instances at https://about.beneath.dev/docs/concepts/tables/.

async create_instance(version: Optional[int] = None, make_primary=None, update_if_exists=None)beneath.instance.TableInstance[source]

Creates and returns a new instance for the table. Learn more about instances at https://about.beneath.dev/docs/concepts/tables/.

Parameters
  • version (int) – The version number to assign to the instance. If not set, will create a new instance with a higher version number than any previous instance for the table.

  • make_primary (bool) – Immediately make the new instance the table’s primary instance

  • update_if_exists (bool) – If true and an instance for version already exists, will update and return the existing instance.

async delete()[source]

Deletes the table and all its instances and data.

restore_cursor(replay_cursor: bytes, changes_cursor: bytes)[source]

Restores a cursor previously obtained by querying one of the table’s instances. You must provide the cursor bytes, which can be found as properties of the Cursor object.

async write(records: Union[Mapping, Iterable[Mapping]])[source]

Writes records to the table’s primary instance.

This is a convenience wrapper for table.primary_instance.write(...).