Query a PostgreSQL database interactively with smart auto-complete that suggests table and column names as you type.
Get a confirmation prompt before running DELETE or UPDATE statements on a production database to avoid accidents.
Replace the built-in psql client with a color-highlighted, cleanly formatted terminal interface for daily database work.
Install with one command via Homebrew on macOS or pip/pipx on Linux, then connect with `pgcli <dbname>`.
pgcli is a command-line tool for connecting to and querying a PostgreSQL database. PostgreSQL (often called Postgres) is a popular open-source database used by many web apps and services. pgcli replaces the built-in command-line tool that comes with Postgres, adding features that make it much nicer to use day to day. The main thing pgcli adds is auto-completion: as you type a SQL query, it suggests keywords, table names, and column names from your actual database. If you type "SELECT * FROM" and press Tab, it will show you the tables available in that database. If you then start typing a WHERE clause, it will suggest column names for the table you already picked. This context-aware completion saves time and reduces typos. It also highlights SQL syntax with colors, making it easier to read what you have typed. Results are formatted into clean tables in the terminal output. There is also a warning option that prompts you before running queries that could delete or overwrite data, which is useful if you work directly on production databases. Installation is straightforward. On macOS you can install it with Homebrew in one command. On Linux many distributions package it directly, and it is also available via pip (the standard Python package installer) or tools like pipx and uvx. It can also be run inside a Docker container if you want to try it without installing anything on your machine. Once installed, you connect by typing pgcli followed by your database name or a full connection URL. A configuration file is created automatically on first launch where you can adjust prompts, row limits, and other preferences. The project is open source and actively maintained, with instructions for contributors in the repository.
← dbcli on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.