Skip to main content

Polygres CLI

Use the Polygres CLI to manage projects, load data, apply migrations, and configure retrieval from your terminal.

The CLI signs in through the Polygres dashboard. It does not expose database passwords.

Install

Install the CLI with pip:

pip install polygres-cli

For an isolated global installation, use pipx:

pipx install polygres-cli

The installed command is polygres.

Get started

Sign in, choose a project, and check that it is ready:

polygres login
polygres whoami
polygres projects list
polygres projects use <project-id-or-exact-name>
polygres ready

polygres login opens the dashboard for approval. On a headless terminal, it prints a URL that you can open in another browser. Run polygres logout when you want to revoke the session and remove the local credentials.

Synchronized PostgreSQL projects

Create a synchronized project with one command:

# Set SOURCE_DATABASE_URL through your shell or secret manager, then reference
# the variable by name so the URL is not passed as a command argument.
polygres projects create sync analytics \
  --connection-env SOURCE_DATABASE_URL \
  --table public.customers \
  --table public.orders \
  --yes

The command checks sync availability, inspects the source, discovers and selects tables, creates the project, and waits for readiness. Use --all-eligible instead of repeated --table options to synchronize every fully eligible discovered table. In an interactive terminal, omitting all table-selection options opens a selection prompt.

The command accepts either a PostgreSQL URL through --connection-env NAME, or structured --host, --database, --username, and --password-env NAME options. In an interactive terminal, the URL or structured password can instead be entered through a hidden prompt. The CLI intentionally has no plaintext URL or password argument.

For explicit unique-key choices or partial-table sync, pass --file selection.json. The file contains a tables array using schema_name, table_name, optional sync_key_index_name, and optional included_columns fields. Pass --idempotency-key to safely resume the full workflow after an ambiguous timeout.

Projects whose control-plane payload has project_mode: "synced" do not expose database connection metadata. The CLI rejects db info, db psql, and env with SYNCED_PROJECT_SURFACE_UNAVAILABLE (permission exit code 4) before it opens a database client. Readiness, vector, hybrid, graph, text-search, and pgContext (context) commands remain available when the project is ready.

The existing standard-project shorthand remains supported:

polygres projects create <name>

Common workflows

Load data and apply migrations

polygres import csv ./documents.csv --table documents --wait
polygres migrations apply --file ./001_create_documents.sql

Configure retrieval

polygres graph discover --json > graph.json
polygres graph config apply --file graph.json
polygres vector configs list
polygres text configs list

Creating new pgvector configurations is retired. Use polygres context collections create to create a pgContext collection and native pgcontext.vector column. Existing vector configuration list, retrieval, and lifecycle commands remain available for previously registered columns.

Work with pgContext AI Search

pgContext uses named collections and is the supported path for new vector setup.

polygres context capabilities
polygres context sources discover
polygres context collections create support_docs \
  --source new-table \
  --table support_docs \
  --dimensions 768
polygres context search support_docs \
  --embedding-file query-embedding.json

Commands that change a collection wait for the server operation to finish by default. Use --no-wait to return as soon as the operation is accepted.

Global options must come before the command namespace:

polygres --project <project-id> --json context collections list

Use additional API routes

The api commands give automation access to supported project-management routes that do not yet have a dedicated high-level command.

polygres api routes
polygres --json api routes --method GET
polygres --json --project <project-id> api request \
  /projects/{project_id} \
  --method GET \
  --dry-run

The CLI validates the route, HTTP method, parameters, and JSON body against its bundled API specification before sending the request. Run with --dry-run to inspect a request without executing it.

Single-row writes

Write one JSON object through the Runtime API without opening a database connection. Use a named file or --file - for standard input.

polygres --project <project-id> rows upsert \
  --schema public --table memories --file row.json \
  --conflict-column id --returning id

printf '%s' '{"id":"memory_123","content":"hello"}' | \
  polygres --project <project-id> rows upsert \
  --table memories --file - --conflict-column id

Context behavior is never inferred for an ordinary table. Pass --context-collection <uuid> or --reconcile-context to make the same command write the row and reconcile one pgContext point. Context-backed commands wait by default and display a resumable idempotency key; --no-wait returns the durable operation ID.

Notices and automation

Service and release notices are written to standard error, so standard output and --json remain safe for scripts. The CLI never sends command arguments or command output when checking for notices.

Version and support

Package version: 0.4.0.

Useful commands:

polygres --version
polygres --help

Exit codes distinguish validation (2), authentication (3), permission (4), not found (5), conflict (6), rate limiting (7), service availability (8), and missing local tools such as psql (9).

CLI and SDK

Install polygres-cli for terminal workflows. Install polygres-sdk in an application that needs graph, vector, text, or hybrid retrieval. The two packages are independent.

Users of the former combined polygres package should install both packages separately when they need both interfaces.

Changelog

See the CLI 0.4.0 release notes for release changes.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polygres_cli-0.4.0.tar.gz (239.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polygres_cli-0.4.0-py3-none-any.whl (203.7 kB view details)

Uploaded Python 3

File details

Details for the file polygres_cli-0.4.0.tar.gz.

File metadata

  • Download URL: polygres_cli-0.4.0.tar.gz
  • Upload date:
  • Size: 239.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for polygres_cli-0.4.0.tar.gz
Algorithm Hash digest
SHA256 89fb52ef26f37519f641d12275c0f1556c2eef2f3c6f64b2609132ba7a64478c
MD5 5da9370fd13012cdd9394786703b3508
BLAKE2b-256 b9c209cd80027f263850f26fc2dfba81596d01ded71c437cc4096564c15792bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for polygres_cli-0.4.0.tar.gz:

Publisher: publish-python-cli.yml on Evokoa/polygres-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polygres_cli-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: polygres_cli-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 203.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for polygres_cli-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d12902c9802a6a088cd816db0a425aeb7f21a5406c763205e07f7c8643b85037
MD5 1c80a155fa6a5adde64fba45b040b0e5
BLAKE2b-256 1776a0445e7d6af03caea6b1a3ea6060d2de092e90d65fc161f197216e13dceb

See more details on using hashes here.

Provenance

The following attestation bundles were made for polygres_cli-0.4.0-py3-none-any.whl:

Publisher: publish-python-cli.yml on Evokoa/polygres-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.4.1

2 files

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page