talira

Postgres CLI with autocompletion and syntax highlighting

open sourceBSD-3-Clausefree

pgcli is a command-line client for PostgreSQL with context-aware autocompletion and syntax highlighting, a friendlier alternative to psql in the terminal. As you type it completes SQL keywords and the connected database's tables and columns, suggesting only what fits where the cursor is, and it supports psql's backslash commands, connection by database name, URI or named DSN aliases from its config file, a row limit for big results, an external editor for long queries, and named queries you can save and reuse. It's written in Python and installs with pip, Homebrew or apt. It's part of the dbcli family, alongside mycli for MySQL and litecli for SQLite.

Problems it solves

  • I can never remember my table and column names when typing queries in psql
  • psql has no syntax highlighting and long queries are hard to read
  • autocomplete column names after SELECT in a Postgres terminal client
  • save connection aliases for my staging and production Postgres databases
  • stop a careless SELECT from dumping a million rows into my terminal
  • edit a long SQL query in my editor and run it against Postgres
  • save frequently used queries and run them by name from the terminal

Features

  • context-aware autocompletion of SQL keywords, tables and columns
  • syntax highlighting
  • psql-style backslash commands
  • connections by name, URI or DSN alias
  • row limit for large results
  • external editor for queries
  • named queries
  • config file at ~/.config/pgcli/config
  • pretty-printed tables

Capabilities

Has a command line toolplan not known