explaingit

dbcli/pgcli

13,157PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

A smarter PostgreSQL command-line client with auto-complete for table and column names, syntax highlighting, and an optional safety prompt before running destructive queries.

Mindmap

mindmap
  root((repo))
    What it does
      PostgreSQL client
      Context auto-complete
      Syntax highlighting
    Features
      Table name completion
      Column name completion
      Destructive query warning
    Installation
      Homebrew macOS
      pip or pipx Linux
      Docker container
    Audience
      Developers
      Database admins
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Query a PostgreSQL database interactively with smart auto-complete that suggests table and column names as you type.

USE CASE 2

Get a confirmation prompt before running DELETE or UPDATE statements on a production database to avoid accidents.

USE CASE 3

Replace the built-in psql client with a color-highlighted, cleanly formatted terminal interface for daily database work.

Tech stack

PythonPostgreSQL

Getting it running

Difficulty · easy Time to first run · 5min

Install with one command via Homebrew on macOS or pip/pipx on Linux, then connect with `pgcli <dbname>`.

In plain English

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.

Copy-paste prompts

Prompt 1
I just installed pgcli. Show me how to connect to my local Postgres database called 'myapp' and run a query using auto-complete.
Prompt 2
How do I configure pgcli to always warn me before running a DELETE or UPDATE query on my production database?
Prompt 3
Using pgcli, how do I browse my query history and switch the output to a wider table format that doesn't wrap columns?
Prompt 4
Show me how to run pgcli inside Docker so I can connect to a Postgres container without installing pgcli locally.
Open on GitHub → Explain another repo

← dbcli on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.