Skip to main content

Concurrent requests

Use sync (def) endpoint handlers, not async def. FastAPI puts def on a thread pool. Pixeltable gives each thread its own connection. async def that calls Pixeltable blocks the event loop. Use FastAPIRouter unless you need custom FastAPI handlers. If you write your own, use def, not async def:
.collect() returns a ResultSet; call to_pydantic() before FastAPI returns the value. Or to_pandas().to_dict(orient='records'). One Python process writes to ~/.pixeltable/pgdata. Several API workers need a shared volume and still one writer. Two pods on the same pgdata corrupt the database. If you need more than one process writing the database, use Pixeltable Cloud.

GPU

Local Hugging Face / Ollama models use CUDA when present, otherwise CPU. Restrict devices with CUDA_VISIBLE_DEVICES.

Errors

Read failures with table.column.errortype and table.column.errormsg.

Schema after the first pxt schema update

Adding a column or index computes values only for that new object. Replacing a computed column recomputes it. Dropping a column deletes its data. Change the class in app.py and run pxt schema update again. Notebooks: Iterative workflow cookbook. table.revert() undoes the last change on that table. Version control for what counts as one change.

Run it

Each starter-kit app ships a Dockerfile and docker-compose.yml. In the container, run pxt schema update app.py agent -f once (-f skips the yes/no prompt), then start HTTP. Pass agent or videointel as the last argument, matching the starter app you copied. pxt service run starts HTTP in this container’s foreground. Locally you usually run pxt service update instead:
Use pxt.create_dir(...) for per-user namespaces in one database. Use separate containers if each tenant must not share pgdata.
Only one process writes ~/.pixeltable/pgdata. Do not mount the same pgdata on two pods.

Monitoring

Insert/compute traces: pip install 'pixeltable[otel]', then Observability.
Provider limits in config.toml. Configuration.
Throttle a custom endpoint with resource_pool. Default is 600 requests per minute.

Troubleshooting

Development reset (deletes data):
Last modified on September 3, 2026