Databases
Inspect workspace databases, query table records, and import CSV data with the Ploy CLI.
Command overview
ploy database list
ploy database tables <databaseId>
ploy database query <databaseId> <tableId>
ploy database import <databaseId> --file <path> --table-name <name>| Command | What it does |
|---|---|
list | Lists the databases in the effective workspace. |
tables | Lists the tables in one database. |
query | Returns rows from one table, with optional search and cursor pagination. |
import | Imports a CSV into a new or existing table and types columns automatically. |
List databases
ploy database listAdd --json to print the API response as JSON.
List tables
ploy database tables <databaseId>databaseId is required. Add --json to print the API response as JSON.
Query table rows
ploy database query <databaseId> <tableId>
ploy database query <databaseId> <tableId> --limit 100
ploy database query <databaseId> <tableId> --search "enterprise"
ploy database query <databaseId> <tableId> --cursor <cursor> --jsonThe table ID uses the tbl_… format.
| Option | Meaning |
|---|---|
--limit <n> | Maximum rows to return, from 1 to 500. |
--search <text> | Runs a full-text search across the table. |
--cursor <cursor> | Continues from the pagination cursor returned by a prior query. |
--json | Prints the full page object—rows, nextCursor, and hasMore—as one JSON line. |
Import a CSV
The first CSV row must contain column headers. Columns are typed automatically during import.
Create a new table
ploy database import <databaseId> --file ./records.csv --table-name RecordsImport into an existing table
ploy database import <databaseId> --file ./records.csv --table-id tbl_…| Option | Meaning |
|---|---|
--file <path> | Reads the CSV from a file. Without it, the command reads standard input. |
--table-name <name> | Creates a new table with this name. |
--table-id <tableId> | Imports into an existing tbl_… table. |
--idempotency-key <key> | Deduplicates a retried import so it does not insert the same rows twice. |
--json | Prints the API response as JSON. |
Give exactly one of
--table-nameor--table-id.
To pipe a CSV through standard input:
cat ./records.csv | ploy database import <databaseId> --table-name Records --idempotency-key records-2026-08-19Get built-in help
ploy database --help
ploy database list --help
ploy database tables --help
ploy database query --help
ploy database import --helpKeep going
- Check the complete CLI contract for global options, environment variables, saved state, and exit codes.
- Manage workspaces and sites, including site creation, status, publishing, and Code Sync.
- Equip local agents with Ploy skills and inspect a site's design-system context.
- Run the CLI from remote agents and CI with API tokens and non-interactive commands.
