pxt CLI ships with the pixeltable package. It covers two surfaces:
- Catalog operations — inspect, query, and manage tables, views, and directories. Backed by a long-lived local daemon so each command takes ~40 ms after the first invocation.
-
Service deployment — turn tables, computed columns, and
@pxt.queryfunctions into HTTP endpoints withpxt serve, and publish them withpxt deploy.pxt serverequires theserveextra (which pulls infastapi[standard]anduvicorn):
pxt auto-spawns a daemon bound to 127.0.0.1:22089. The daemon survives across shells and stays warm for subsequent commands. Override the port with PXT_PORT.
Command structure
pxt <command> --help for per-subcommand flags and examples.
Universal flags
These flags work the same way across the catalog commands that support them and are not repeated in the per-command tables below.Quick reference
Inspection commands
pxt ls
List entries under a directory.
pxt ls -l:
c = has at least one computed column, i = has at least one index.
pxt describe
Show a table’s schema and metadata. The plain form is human-readable; --json returns the full get_metadata() dict.
pxt columns / pxt computed
List columns for one or more tables. pxt computed is shorthand for pxt columns --computed. The path argument may be a single table or a directory; a directory path lists columns for every table beneath it, recursively. A directory path may be a local path or a hosted uri (pxt://org:db/...). With no path, every table in the in-process catalog is listed.
pxt idxs
List indexes. Shows both B-tree and embedding indexes by default; the --embedding flag restricts to embedding indexes. Like pxt columns, the path may be a single table or a directory (walked recursively), a hosted database root (pxt://org:db), or omitted for the whole in-process catalog.
pxt history
Show a table’s version timeline.
pxt status
Daemon and runtime state: pxt version, daemon PID, configured paths, total tables, total errors.
pxt config
Every documented configuration setting with its current value and source (env, file, or unset). Credentials show <redacted> when set; the source column reveals presence even when the value is masked.
Query commands
pxt rows
Show the first N rows of a table. Unstored computed columns are skipped by default (selecting one forces evaluation, which can invoke LLMs or expensive compute); pass them explicitly via --cols to include them.
pxt get
Look up a single row by primary key. A numeric-looking PK token is coerced to int or float; everything else stays a string. There is no quoting escape for a string-typed PK whose value looks numeric — if your PK column is a string but the value is 42, the server will reject the type mismatch. The table must declare a primary key. Unstored computed columns are skipped unless requested explicitly via --cols (consistent with rows).
pxt count
pxt errors
List rows where a stored computed column failed. The table must have a primary key (so each failing row can be identified).
Mutation commands
Every mutation accepts the universal-n/--dry-run and --json flags. The destructive ones (drop, rm, revert) also prompt [y/N] with a TTY and accept -f/--force to skip the prompt; in non-interactive contexts they refuse to proceed without -f. rename and mv don’t prompt: renaming or moving a catalog entry is reversible and doesn’t lose data.
pxt drop
Drop a table or view. Use pxt rm for directories.
pxt rm
Remove a directory. Use pxt drop for tables/views.
pxt rename
Rename in place; the parent directory is preserved. <new_name> must be a single leaf name (no / or .). Takes only universal flags.
pxt mv
Move a table/view/dir under a different directory; the leaf name is preserved. <new_dir> can be '' or / for the root directory. Takes only universal flags.
pxt revert
Undo recent ops on a table. Each revert undoes one op; --steps repeats.
Interactive shell
For agentic or scripted workloads that issue many commands in sequence,pxt shell amortizes Python startup over the session:
pxt command is available unmodified. Errors from one command don’t kill the session. Use help, exit, quit, or Ctrl-D to leave.
Output and scripting
Most catalog commands accept--json for stable, machine-readable output (exceptions: shell is interactive, health is already JSON):
--json, output is column-aligned text.
Serving
pxt serve turns tables, computed columns, and @pxt.query functions into HTTP endpoints, no application code required. The serve and deploy subcommands import pixeltable directly and require the serve extra (pip install 'pixeltable[serve]'), which pulls in fastapi[standard] and uvicorn.
pxt serve generates a full FastAPI application with auto-generated OpenAPI docs at /docs. For programmatic control over the same endpoints, see the Python serving API using FastAPIRouter.pxt serve subcommands
Quick start
Named service (TOML config)
Define your routes in a TOML file and start everything with one command:Output
Single-endpoint mode
For quick experiments, skip the TOML file and configure one route directly:Serve flags
Everypxt serve subcommand accepts these flags:
When
--json is set, a successful start emits:
--dry-run and --json to validate a config in CI without starting a server:
pxt serve insert
Start a service with a single insert endpoint.
SQL export flags are also available on insert and update routes. See SQL export flags.
pxt serve update
Start a service with a single update endpoint. The table must have a primary key.
pxt serve delete
Start a service with a single delete endpoint.
pxt serve query
Start a service with a single query endpoint.
The dotted path is resolved at startup; the module is imported automatically.
SQL export flags
Insert and update routes can export each successful request as a row in an external SQL database. These flags mirror theexport_sql TOML config:
pxt deploy
Builds a deploy bundle for the specified environment. See Deployment Overview for how environments are configured.
Serve patterns
Validate a config without starting a server
Output
Override port for local development
File upload endpoint
Background processing for slow pipelines
job_url until status is "done" or "error".
What’s next
- Working with the Pixeltable CLI: hands-on cookbook for inspect, query, debug, and serve workflows
- HTTP Serving Guide: TOML config reference, Python
FastAPIRouterAPI, decorator routes - Deployment Overview: production architecture and deployment strategies
- Configuration: API keys, storage paths, and environment settings