---
title: "What is a TableModel?"
description: "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."
url: "https://pixeltable.com/learn/what-is-a-tablemodel"
updated: "2026-09-29"
vertical: "Multimodal data"
doc: "https://docs.pixeltable.com/overview/quick-start"
---

# 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: 2026-09-29


## On this page

- [How it works](https://pixeltable.com/learn/what-is-a-tablemodel#how-it-works)
- [What it is not](https://pixeltable.com/learn/what-is-a-tablemodel#what-it-is-not)
- [Comparison](https://pixeltable.com/learn/what-is-a-tablemodel#comparison)
- [Where Pixeltable fits](https://pixeltable.com/learn/what-is-a-tablemodel#where-pixeltable-fits)
- [Questions](https://pixeltable.com/learn/what-is-a-tablemodel#questions)

## How it works {#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 {#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 {#comparison}

|  | This | Not this |
| --- | --- | --- |
| Form | Classes in one file | A sequence of create calls |
| Change | Edit the class and apply | A migration you write by hand |
| Serve | Routes declared beside the tables | A second app that copies rows |

## Where Pixeltable fits {#where-pixeltable-fits}

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

```python
import pixeltable as pxt

TableModel = pxt.model_base()

class Docs(TableModel, name='docs'):
    text: pxt.String
```

## Questions {#questions}

### How does TableModel work? {#faq-1}

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? {#faq-2}

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.

## In the blog

- [The Unified Multimodal Backend Agents Build With](https://pixeltable.com/blog/unified-multimodal-backend-agents-build-with)
- [Never Fuck With Your Backend Anymore](https://pixeltable.com/blog/never-fuck-with-your-backend-anymore)
- [One Swing, Many Frames: How We Aggregated Video into a Summary with Pixeltable](https://pixeltable.com/blog/one-swing-many-frames-pixelgolf-uda-aggregation)
- [Convex Developers' Guide to Pixeltable: Queries, Mutations, Actions, and Where the Mental Models Diverge](https://pixeltable.com/blog/convex-developers-guide-to-pixeltable)
- [PixelAssist Retrospective: ~2,100 Lines of TypeScript vs. ~40 Lines of Pixeltable](https://pixeltable.com/blog/pixelassist-retrospective-typescript-vs-pixeltable-backend)
- [Pixeltable Selected for PyCon US 2026 Startup Row](https://pixeltable.com/blog/pycon-us-2026-startup-row)

## Related

- [Documentation](https://docs.pixeltable.com/overview/quick-start)
- [The Unified Multimodal Backend Agents Build With](https://pixeltable.com/blog/unified-multimodal-backend-agents-build-with)
- [Never Fuck With Your Backend Anymore](https://pixeltable.com/blog/never-fuck-with-your-backend-anymore)
- [Pixeltable vs Cohesivity](https://pixeltable.com/compare/pixeltable-vs-cohesivity)
- [Pixeltable vs Convex](https://pixeltable.com/compare/pixeltable-vs-convex)
