Multimodal data

What is a TableModel?

A TableModel is a Python class that declares tables, computed columns, and indexes. HTTP routes are a FastAPIRouter next to the class, not fields on it.

Updated

How it works

  • Annotations are stored columns. Assignments are computed columns.
  • A subclass with base= and iterator= is a view.
  • Applying the file creates or migrates the catalog to match the classes.

What it is not

It is not an ORM mapped only to scalar SQL types, and it is not a notebook script that creates tables imperatively for the same objects.

TableModel: this, and the thing it is confused with

TableModel: this, and the thing it is confused with
ThisNot this
FormClasses in one fileA sequence of create calls
ChangeEdit the class and applyA migration you write by hand
ServeRoutes declared beside the tablesA second app that copies rows

Where Pixeltable fits

Pixeltable’s schema file sets TableModel = pxt.model_base() and subclasses it. pxt schema update applies that file.

import pixeltable as pxt
TableModel = pxt.model_base()
class Docs(TableModel, name='docs'):
text: pxt.String

Questions

How does TableModel work?
Annotations are stored columns. Assignments are computed columns. A subclass with base= and iterator= is a view. Applying the file creates or migrates the catalog to match the classes.
What is TableModel often confused with?
It is not an ORM mapped only to scalar SQL types, and it is not a notebook script that creates tables imperatively for the same objects.