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 withCUDA_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 aDockerfile 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:
pxt.create_dir(...) for per-user namespaces in one database. Use separate containers if each tenant must not share pgdata.
Monitoring
Insert/compute traces:pip install 'pixeltable[otel]', then Observability.
config.toml. Configuration.
resource_pool. Default is 600 requests per minute.