Catalog tables let you persist arbitrary tabular data, including results derived from queries on your datasets.
Examples include per-segment metrics, evaluation results, annotations, and processing status.
A common use case is to save these results so you can share them with colleagues, then inspect or update them later.
A table with a rerun_segment_id column can carry per-segment metadata and be joined with the segment table of a dataset.
See Adding metadata to registered segments for how this compares with properties.
Catalog tables use Arrow schemas, and catalog query APIs return lazy DataFusion dataframes. Unlike datasets, tables use schema-on-write: you define the table's Arrow schema before writing rows. See the catalog object model for how tables relate to other catalog entries.
If you only want to display an ephemeral table in a running Viewer, see Send tables to Rerun instead.
Storing query results in a catalog table walks through a complete example: it creates a table from a dataset query, reads it back, joins it with the dataset, and updates it.
Create a table
CatalogClient.create_table creates an empty table from an Arrow schema and returns its TableEntry.
In a later session, retrieve the table by name with get_table.
On Rerun DB Local, you can pass url to create_table to choose the storage directory.
If you omit url, the server writes the table to its default storage directory.
The files remain on disk after shutdown, but the local catalog entry does not.
Rerun DB always uses its configured storage instead, so do not pass url.
Read a table
Call reader() on the table entry to get a DataFusion dataframe that you can filter, aggregate, or join.
To join a table with the segments of a dataset, see Join with a dataset.
Update a table
DataFrame.write_table executes a lazy DataFusion query and appends its rows to a table without first collecting the result into Python.
For direct updates, a TableEntry supports three mutation operations using Arrow record batches:
appendadds rows to the existing table.overwritereplaces all existing rows.upsertreplaces rows with matching table-index values and appends rows with new values.
Catalog tables do not need an index for ordinary writes.
Upserts require one field in the table schema to have rerun:is_table_index metadata.
Choose the field that identifies rows in your table.
The rr.SORBET_IS_TABLE_INDEX constant provides the metadata key.
An upsert replaces the entire matching row, so omitted columns are written as null rather than retaining their previous values.
Give columns semantic meaning
A plain Arrow field only says how a column's values are stored, such as booleans or strings.
A Rerun component type also says what the values mean, for anyone who reads the table.
The Viewer uses this meaning to pick the UI for the column, such as flag buttons for a Flag column and links for a Url column.
table_field on a component class returns a schema field with the component's Arrow datatype and component type.
With editable=True, the column can be edited in the Viewer.
Editing needs a table index and write permission.
schema = pa.schema([
pa.field("id", pa.int64(), metadata={rr.SORBET_IS_TABLE_INDEX: "true"}),
rr.components.Url.table_field("link"),
rr.components.Flag.table_field("reviewed", editable=True),
rr.components.Text.table_field("notes", editable=True),
])A table blueprint can override both the component type and whether a column is editable.
Register an existing table
Use create_table to create a new table managed by the catalog.
If you already have a Lance table, CatalogClient.register_table makes it available in the catalog without copying its data:
existing_table_url = "s3://my-bucket/tables/external_metrics.lance"
external_table = client.register_table("external_metrics", existing_table_url)The URL must identify the Lance table itself rather than its parent directory. The Rerun DB server must have the permissions needed to access it.
Remove a table
Call delete() on its TableEntry to remove a table from the catalog.