Manage PloyDB with the CLI

Create and manage databases, tables, columns, and rows from the command line. You can also duplicate data asynchronously and import typed CSV files.

Databases

ploy database list [--json]

Lists the current workspace's databases.

List databases
ploy database list
ploy database list --json
  • --json prints { "databases": [...] } instead of tab-separated database ID and name lines.

ploy database create --name <name> [options]

Creates an empty database, or asynchronously duplicates another database when --from is supplied.

Create or duplicate a database
ploy database create --name "Content"
ploy database create --name "Content copy" --from <databaseId>
ploy database create --name "Content copy" --from <databaseId> --operation-key <uuid> --json
OptionMeaning
--name <name>Required display name for the new database.
--from <databaseId>Duplicates an existing database, including its tables and rows.
--operation-key <uuid>Reuses or rejoins a duplication operation. Requires --from. The CLI generates a UUID when omitted.
--jsonPrints the created database or duplication receipt as JSON.

ploy database rename <databaseId> --name <name> [--json]

Changes a database's display name.

Rename a database
ploy database rename <databaseId> --name "Customer content"
  • <databaseId> identifies the database to rename.
  • --name <name> is the required new display name.
  • --json prints the updated database as JSON.

ploy database archive <databaseId> [--json]

Archives a database without permanently deleting its stored data.

Archive a database
ploy database archive <databaseId>

There is currently no command for permanently deleting a database.

ploy database operation <operationId> [--json]

Reads the status of an asynchronous database or table duplication.

Check duplication progress
ploy database operation <operationId> --json

Possible statuses are in_progress, succeeded, and failed. A failed operation returns exit code 1.

Tables

ploy database table list <databaseId> [--json]

Lists the tables in a database.

List tables
ploy database table list <databaseId>

--json prints { "tables": [...] } instead of tab-separated table ID and name lines.

ploy database table create <databaseId> --name <name> [--json]

Creates a table using the product's starter columns and placeholder rows.

Create a table
ploy database table create <databaseId> --name "Contacts"

ploy database table duplicate <databaseId> <tableId> [options]

Asynchronously duplicates a table, including its columns and rows.

Duplicate a table
ploy database table duplicate <databaseId> <tableId> --operation-key <uuid> --json
  • --operation-key <uuid> reuses or rejoins a duplication operation. The CLI generates a UUID when omitted.
  • --json prints the duplication receipt as JSON.

Use ploy database operation <operationId> to inspect progress.

ploy database table rename <databaseId> <tableId> --name <name> [--json]

Changes a table's name.

Rename a table
ploy database table rename <databaseId> <tableId> --name "Customers"

ploy database table delete <databaseId> <tableId> [--json]

Permanently deletes a table, including its columns and rows.

Delete a table
ploy database table delete <databaseId> <tableId>

Columns

ploy database column list <databaseId> <tableId> [--json]

Lists a table's columns, including each field ID, label, and type.

List columns
ploy database column list <databaseId> <tableId>

--json prints { "columns": [...] } instead of tab-separated field ID, label, and type lines.

ploy database column add <databaseId> <tableId> --name <name> [options]

Adds a column to a table. The type defaults to TEXT.

Add columns
ploy database column add <databaseId> <tableId> --name "Company"
ploy database column add <databaseId> <tableId> --name "Contract value" --type CURRENCY
ploy database column add <databaseId> <tableId> --name "Private notes" --type LONG_TEXT --secret
OptionMeaning
--name <name>Required column name.
--type <type>Column type. Defaults to TEXT.
--secretMarks the new column as secret.
--jsonPrints the created column as JSON.

Supported column types

Column types
TEXT
LONG_TEXT
NUMBER
CURRENCY
PERCENT
CHECKBOX
SELECT
MULTI_SELECT
STATUS
PEOPLE
DATE
URL
EMAIL

ploy database column rename <databaseId> <tableId> <fieldId> --name <name> [--json]

Changes a column's display name.

Rename a column
ploy database column rename <databaseId> <tableId> <fieldId> --name "Account name"

ploy database column retype <databaseId> <tableId> <fieldId> --type <type> [--json]

Changes a column's type and automatically converts all existing values.

Change a column type
ploy database column retype <databaseId> <tableId> <fieldId> --type NUMBER

ploy database column secret <databaseId> <tableId> <fieldId> <state> [--json]

Marks or unmarks a column as secret. Set <state> to on or off.

Change a column's secret state
ploy database column secret <databaseId> <tableId> <fieldId> on
ploy database column secret <databaseId> <tableId> <fieldId> off

ploy database column delete <databaseId> <tableId> <fieldId> [--json]

Permanently deletes a column and every value stored in it.

Delete a column
ploy database column delete <databaseId> <tableId> <fieldId>

Rows

ploy database row list <databaseId> <tableId> [options]

Lists and paginates rows, with optional text search, filters, and ordered sorting.

List and query rows
ploy database row list <databaseId> <tableId>
ploy database row list <databaseId> <tableId> --limit 100 --search "enterprise"
ploy database row list <databaseId> <tableId> --filter <fieldId>:contains:software --sort <fieldId>:asc
ploy database row list <databaseId> <tableId> --cursor <cursor> --json
OptionMeaning
--limit <n>Maximum rows to return. Must be from 1 through 500.
--search <text>Case-insensitive substring search across text-based columns.
--filter <fieldId>:<operator>[:<value>]Filters rows. Repeat up to 50 times.
--sort <fieldId>:<asc|desc>Sorts rows in the supplied order. Repeat up to 10 times.
--cursor <cursor>Continues from the cursor returned by a previous list request.
--jsonPrints the complete { rows, nextCursor, hasMore } page as one JSON line.

Without --json, each row is printed as one JSON object:

Default row output
{"id":"row_...","fields":{"fld_...":"value"}}

Supported row filters

Column typesOperators
Text, long text, URL, emailcontains, eq, neq, is_null, is_not_null
Number, currency, percent, dateeq, neq, gt, gte, lt, lte, is_null, is_not_null
Select, status, checkboxeq, neq, is_null, is_not_null
Multi-select, peoplelist_contains, list_not_contains, is_null, is_not_null

Filter values may contain colons because the CLI splits only the first two colons. is_null and is_not_null do not accept a value.

ploy database row add <databaseId> <tableId> [options]

Adds one row to a table. If neither value source is supplied, the command creates an empty row.

Add a row
ploy database row add pdb_123 tbl_456 --values '{"fld_name":"Ada","fld_active":true}'
ploy database row add <databaseId> <tableId> --file ./row.json
cat ./row.json | ploy database row add <databaseId> <tableId> --file -
  • --values <json> accepts a JSON object keyed by column field ID.
  • --file <path> reads that JSON object from a file. Use - for standard input.
  • --values and --file are mutually exclusive.
  • --json prints the created row as JSON.

ploy database row update <databaseId> <tableId> <rowId> [options]

Updates selected fields in one row. Fields omitted from the input remain unchanged.

Update a row
ploy database row update <databaseId> <tableId> <rowId> --values '{"fld_active":false}'
ploy database row update <databaseId> <tableId> <rowId> --file ./changes.json

Supply exactly one useful value source: a non-empty JSON object through --values, or a file through --file. The two options are mutually exclusive.

ploy database row delete <databaseId> <tableId> <rowId> [--json]

Deletes one row.

Delete a row
ploy database row delete <databaseId> <tableId> <rowId>

CSV import

ploy database import <databaseId> (--table-name <name> | --table-id <tableId>) [options]

Imports a CSV into a newly created or existing table and automatically determines column types.

Import CSV data
ploy database import <databaseId> --table-name "Records" --file ./records.csv
ploy database import <databaseId> --table-id <tableId> --file ./records.csv --dry-run
cat ./records.csv | ploy database import <databaseId> --table-name "Records" --idempotency-key <key>
OptionMeaning
--table-name <name>Creates a new table with this name and imports into it.
--table-id <tableId>Imports into an existing table.
--file <path>Reads CSV from a file. When omitted, reads CSV from standard input.
--idempotency-key <key>Sets an explicit retry-deduplication key. When omitted, the CLI derives a stable key from the target, headers, and rows.
--dry-runValidates and describes the import without writing data.
--jsonPrints the import result as JSON.

Give exactly one of --table-name or --table-id. The first CSV row is treated as the header.

Get built-in help

Inspect database command help
ploy database --help
ploy database create --help
ploy database table --help
ploy database column --help
ploy database row --help
ploy database import --help

Keep going