vastdb.schema

VAST Database schema (a container of tables).

VAST S3 buckets can be used to create Database schemas and tables. It is possible to list and access VAST snapshots generated over a bucket.

class vastdb.schema.Schema(name: str, bucket: Bucket)[source]

Bases: object

VAST Schema.

bucket: Bucket
create_schema(name: str, fail_if_exists=True) Schema[source]

Create a new schema (a container of tables) under this schema.

create_table(table_name: str, columns: pyarrow.Schema, fail_if_exists: bool = True, use_external_row_ids_allocation: bool = False, sorting_key: list[int] | list[str] = [], vector_index: VectorIndexSpec | None = None) Table[source]

Create a new table under this schema.

A virtual vastdb_rowid column (of int64 type) can be created to access and filter by internal VAST row IDs. See https://support.vastdata.com/s/article/UUID-48d0a8cf-5786-5ef3-3fa3-9c64e63a0967 for more details.

Args:

table_name: Name of the table to create columns: PyArrow schema defining the table columns fail_if_exists: Whether to fail if the table already exists use_external_row_ids_allocation: Whether to use external row ID allocation sorting_key: List of column names to use as sorting key (for Elysium tables) vector_index: Optional vector index.

Returns:

The created table

drop() None[source]

Delete this schema.

name: str
rename(new_name) None[source]

Rename this schema.

schema(name: str, fail_if_missing=True) Schema | None[source]

Get a specific schema (a container of tables) under this schema.

schemas(batch_size=None) Iterable[Schema][source]

List child schemas.

table(name: str, fail_if_missing=True) Table | None[source]

Get a specific table under this schema.

tablenames(page_size=1000) List[str][source]

List all table names under this schema.

tables(table_name: str = '', page_size=1000) List[Table][source]

List all tables under this schema if table_name is empty.

Otherwise, list only the specific table (if exists).

property tx

VAST transaction used for this schema.