Skip to main content

Lifecycle

new

Create a new table. Pass columns to seed the schema in one call; omit it to start empty and add columns later with add_column / add_columns. Parameters
name
str
required
Display name of the table.
columns
Optional[list[ColumnSpec]]
default:"None"
Initial column schema. See ColumnSpec.
Returns
returns
Table
The new Table instance.

fetch

Fetch by id or name. Exactly one is required. username and org_name scope name-fetches to a specific owner.

list

Paginated list of the tables visible to the API key’s org.

update

Rename the table. Mutates self and returns it.

duplicate

Server-side copy of the table (schema + rows). Pass new_name to set the duplicate’s name; otherwise the server auto-generates one.

delete

Permanently delete the table.

Column schema

add_column

Add a single column. format is one of the ColumnFormat variants. generation binds the column to a PipelineGenerator or AgentGenerator — see ColumnGenerator.

add_columns

Add multiple columns in one call. Accepts either a list of ColumnSpec (recommended) or a shorthand {name: kind_string} dict for quick smoke tests.

rename_column

delete_column

update_column

Change a column’s format and/or display_name. Existing cell values must be coercible to the new format.

list_columns

Returns the current column descriptors. table.columns exposes the same list as an attribute.

Row CRUD

read_rows returns one page (about 1,000 rows by default). To iterate over every matching row in a larger table, use scroll / ascroll instead — same filters and columns arguments, but it pages through the whole result set for you.

insert_row

Insert a single row. Keys are column names; values are coerced via the column format. Returns None — use insert_rows when you need the inserted count, or follow up with read_rows(filters=...) to inspect.

insert_rows

Bulk insert. Returns an InsertRowsResult with success and rows_inserted.
If rows have different shapes (different rows omit different columns), bulk insert can fail. Fall back to one insert_row call per row that’s missing columns the others have — your dense rows can still go through insert_rows.

read_rows

Read rows that match filters. Pass columns to project only specific column names. Returns a RowsPage with rows and a total count. Capped at one page (~1,000 rows by default) — use scroll to iterate past that.

update_rows

Apply a partial update to every row matched by filters. filters is required to prevent accidental table-wide updates. Returns the number of rows touched — but note this may be 0 even on success, because the engine does not currently report a count. If you really do want to clear the table, call clear instead.

delete_rows

Delete every row matched by filters. filters is required. Returns the number of rows deleted — but note this may be 0 even on success, because the engine does not currently report a count.

clear

Drop every row in the table while keeping the schema. Use this instead of delete_rows when you genuinely want to empty the table.

scroll

Iterate over all matching rows in fixed-size pages. The iterator stops cleanly at the last page; no trailing empty page is yielded when the row count is a multiple of page_size.

Running generators

A column with a PipelineGenerator or AgentGenerator attached gets its cells filled by table.run(columns=[...]). Without generator columns, run is a no-op.

run

Start filling the named generator columns. Returns a TableRunTask — poll via run_status(task_id) or block via run_and_wait. filters scopes which rows are updated.

run_status

run_and_wait

Blocking variant of run. Raises TableRunTimeout on timeout, TableRunFailed if the task ends in FAILED.

Aggregation

aggregate

Compute one or more aggregations over the rows matched by filters. Each (column, AggregationType) pair returns one value. See AggregationType for the 21 supported functions (SUM, AVERAGE, MEDIAN, MIN, MAX, RANGE, STANDARD_DEVIATION, UNIQUE, EARLIEST_DATE, …).
The result map is keyed by column name, so passing two aggregations on the same column in a single call will only return one of them. Issue one aggregate(...) call per (column, type) pair when you need multiple aggregations on the same column.

Import / export

import_file

Bulk-load rows from a CSV or XLSX file. column_mapping maps file-column names to table-column names. custom_headers lets you supply headers when the file has none. format defaults to AUTO (sniff by extension).

import_file_status

import_file_and_wait

Blocking variant. Raises TableImportTimeout / TableImportFailed.

export

Synchronous export to CSV or Excel. For small exports the server returns the file bytes inline as content. For large exports the server streams to object storage and content is empty — use s3_key (and s3_url if provided) to fetch the file.

Queries

nl_query

Server-side natural-language → SQL. Returns an NlQueryResult with an answer and the intermediate dataframes (protojson-encoded JSON strings).

Serialization

to_dict

Return the table as a plain dict.

Types

ColumnSpec

Input shape for Table.add_column[s] and Table.new(columns=...). Pairs a column name with a typed ColumnFormat and an optional ColumnGenerator.

Column

Returned by list_columns() / table.columns.

ColumnFormat

A column’s format is one of the variants below. Each variant carries a kind literal identifying it.

StringFormat

BoolFormat

NumberFormat

TimestampFormat

SingleSelectFormat / MultiSelectFormat

SelectOption

FileFormat / AudioFormat / ImageFormat

KnowledgeBaseFormat

ListOfFilesFormat / ListOfStringsFormat

ColumnGenerator

Two variants today: PipelineGenerator and AgentGenerator. Attach one to ColumnSpec.generation to make a column AI-filled.

PipelineGenerator

Fills a cell by running the bound Pipeline once per row.
  • input_mappingkeys are pipeline input names, values are table-column names. For each row, the engine reads the value of the named column and passes it into the matching pipeline input. Example: {"vendor_name": "vendor", "raw_notes": "notes"} sends the row’s vendor value to the vendor_name input and the notes value to raw_notes.
  • output_name — which pipeline output to write into the cell.
  • auto_execute=True — the engine fires the pipeline as new rows arrive instead of waiting for an explicit table.run(...).

AgentGenerator

Fills a cell by sending the row through an Agent.
  • instructions — the per-cell prompt template the agent runs against each row.
  • input_mappingkeys are agent input names, values are table-column names. For each row, the engine reads the value of the named column and passes it into the matching agent input.
  • knowledge_base (optional) — gives the agent retrieval context for the cell.
  • auto_execute=True — the engine fires the agent as new rows arrive instead of waiting for an explicit table.run(...).

CompoundFilter

The top-level filter shape consumed by every query verb. Groups join via group_logical_operator; within each FilterGroup, conditions join via that group’s logical_operator. Builders All builders return a new CompoundFilter (the dataclass is frozen).

FilterGroup

FilterCondition

A single leaf condition: “the value of column field should satisfy operator against value”. value is the Python value for that column — bool, int, float, str, datetime, list, or None — and the SDK encodes it for the wire.

TableFilterOperator

The 13 operators you can pass to a FilterCondition, grouped by what they do. Equality and set membership
Ordering (numbers and timestamps)
Text
Missing data
Files

RelationalOperator

OrderByDirection

AggregationType

21 functions covering counts, percentages, numeric reductions, boolean truth-counts, and timestamp ranges: Numeric reductions require numeric columns; boolean reductions require bool columns; timestamp reductions require timestamp columns.

ColumnKind

The resolved kind on a returned Column. One of: string, bool, int, float, currency, percent, timestamp, single_select, multi_select, file, audio, image, knowledge_base, list_of_files, list_of_strings.

NumberKind

ExportFormat

ImportFormat

RunStatus

ImportStatus

Same four values as RunStatus.

Row

TypedDict:

RowsPage

TypedDict:

InsertRowsResult

TypedDict:

AggregationResult

TypedDict:

NlQueryResult

TypedDict:

TableExportResult

TypedDict:

TableRunTask

Frozen dataclass — a poll handle for Table.run.

TableImportTask

Frozen dataclass — a poll handle for Table.import_file.

Errors

All Table errors inherit from TableError (which inherits from VectorshiftError). Catch VectorshiftApiError from vectorshift.request for transport-level failures (HTTP 4xx/5xx).