Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgq

PostgreSQL query tool for pi with SSH tunnel support and named profiles.

Install in pi

pi install git:github.com/Complead/pgq

Or from local path:

pi install /path/to/pgq

Setup

After installation, create your profiles:

mkdir -p ~/.config/pgq

Edit ~/.config/pgq/profiles.json:

{
  "profiles": {
    "production": {
      "dsn": "postgres://user:pass@localhost:25063/mydb?sslmode=require",
      "tunnel": "25063:db-host.com:5432 devops@bastion -i ~/.ssh/id_rsa"
    },
    "local": {
      "dsn": "postgres://postgres:postgres@localhost:5432/mydb?sslmode=disable",
      "tunnel": ""
    }
  }
}

Usage (in pi)

Just ask pi to query your database:

"show me the latest 10 tasks in flashpoint"

Pi will use the pgq skill to pick the right profile and run the query.

Usage (standalone)

pgq --profile production "SELECT count(*) FROM users"
pgq --profile local --format json "SELECT * FROM tasks LIMIT 5"
pgq --profiles  # list configured profiles

Development

go build -o pgq .
./pgq --help

Release

Tag and push to trigger binary builds:

git tag v0.1.0
git push origin v0.1.0

GitHub Actions builds binaries for linux/darwin/windows (amd64+arm64) and attaches them to the release. The postinstall script downloads the correct binary when users install the package.

About

PostgreSQL query tool for pi

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages