Docs
CLI

silos sql & silos connect

Run one-off SQL queries from the command line, or open an interactive psql session against a Silos database.

The CLI gives you two ways to run SQL: silos sql for one-off queries and scripts, and silos connect for an interactive session in psql.

silos sql

Run a single SQL statement against a database and print the result.

Terminal
silos sql my-app "select version();"

Run against a specific branch:

Terminal
silos sql my-app "select count(*) from users;" --branch preview
Argument / flagDescription
<database>Database ID or name to query.
<query>The SQL statement to execute.
--branch <name>, -bRun against the named branch instead of the default.

For machine-readable output in scripts, combine it with the global --format flag:

Terminal
silos --format json sql my-app "select id, email from users limit 10;"

silos sql is convenient for quick checks, migrations smoke tests, and scripting. For large result sets or interactive exploration, use silos connect or a full client.

silos connect

Open an interactive psql session against a database. The CLI resolves the connection string and launches psql for you.

Terminal
silos connect my-app

Connect to a branch:

Terminal
silos connect my-app --branch preview
Argument / flagDescription
<database>Database ID or name to connect to.
--branch <name>, -bConnect to the named branch instead of the default.

silos connect requires psql to be installed and on your PATH. It ships with the PostgreSQL client tools (libpq). If you'd rather not depend on psql, get the raw connection string with silos db connection-string and use any Postgres client.

Which one to use

silos sql

Best for one-off queries, scripts, CI checks, and JSON output you can pipe into other tools.

silos connect

Best for interactive exploration — a full psql prompt with history, meta-commands, and formatting.

On this page