>_ sqlr GitHub

Run a query before your database GUI finishes loading.

sqlr is a small terminal client for SQL. Save a connection once, then run queries, describe tables and pipe results wherever you need them.

PostgreSQLMySQLMSSQLClickHouseSQLite
bash
$ 
● mydb postgresQuery executed in: 42ms · Rows affected: 3

The first argument is either SQL or a path to a .sql file. {{ variables }} in the file are filled from -i "key: value".

Describe the schema

sqlr describe --compact prints tables, columns, types and foreign keys in a form that fits in a prompt.

Three output shapes

Compact rows by default, --table for humans, -o result.json for files and scripts.

Scoped per repository

Connections belong to the git repo you are in. -g uses the global scope instead.

No prompts in CI

Every command takes flags, so pipelines and cron jobs can run it without an interactive wizard.

AI agents query by name. The connection string stays on disk.

Add a connection once with sqlr add. From then on the agent runs sqlr and sees table names and rows, never hosts, users or passwords. sqlr skill --init turns that into a /sqlr slash command for Claude Code, Codex and Cursor.

AI agent
/sqlr find users inactive for 7 days
sqlr "select id, email from users where last_login < now() - interval '7 days'"
sqlr on your machine Looks up the default connection by name sqlr set prod · once per repo
Stored on disk
devpostgres://app@localhost:5432/app
prodpassword protected
The agent never reads this store.

Dev database nothing extra

Store it as is. The agent can query straight away.

$ sqlr add -n dev -t postgresql -s "postgres://app@localhost:5432/app"
$ sqlr set dev

Prod database unlock once per shell

Protect it with a password when adding. Before you start the agent, put that password in an environment variable. The agent inherits the variable but never sees its value, and it is gone when the terminal closes.

$ sqlr add -n prod          # answer yes to "secure connection"
$ export SQLR_ENCRYPTION_PASSWORD="my-prod-password"
$ sqlr set prod
$ claude                    # or codex, cursor…

Install

curl -fsSL sobanieca.github.io/sqlr/install.sh | bash

A single binary for Linux and macOS, no runtime needed. Then sqlr help explains every command on one screen, and sqlr update keeps it up to date.