pgspecial
Meta-commands handler for Postgres Database.
Decision gist · record as of 2026-08-14
Yes, if you need to execute PostgreSQL meta-commands programmatically. The library is stable, has low install friction, carries a permissive license, and is actively used by established projects. The 473-day release gap is a minor concern for a mature, narrow-scope package, but verify compatibility with your PostgreSQL and psycopg versions before production use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.9 and an active psycopg database connection.
- Low friction installation with three lightweight runtime dependencies.
- Maintenance status is aging—last release was 473 days ago—but the package remains in use by established projects.
License · maintenance · safety
BSD (permissive) — BSD permissive license allows use in commercial and proprietary projects with minimal restrictions, requiring only license attribution.
last release 2025-04-28 (473 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 650,487 downloads/mo, #5,561 on PyPI
Alternatives
Verify before relying
pip install pgspecial
from pgspecial.main import PGSpecial
pgspecial = PGSpecial()
for result in pgspecial.execute(cur, sql):
print(result)- Whether the 473-day gap since last release reflects stable maturity or abandonment risk for future PostgreSQL compatibility.
- Current state of the repository (archived status, recent commits) to assess ongoing maintenance.
- Compatibility with current versions of psycopg and PostgreSQL.
What it is and what it does
pgspecial is a Python library that wraps PostgreSQL's meta-commands—the backslash commands you'd normally type in psql—into a callable API. It lets you execute commands programmatically against a live database connection, returning structured results you can process in code.
The library is designed for tools that need to expose PostgreSQL introspection and administration commands without reimplementing them. It depends on click, sqlparse, and psycopg for the database connection itself. You instantiate PGSpecial, pass it a cursor and a command string, and iterate over the results. It also supports loading named queries from config files via the NamedQueries class.
Use it for
- Building a PostgreSQL REPL or interactive shell that supports backslash commands.
- Adding database introspection to a Jupyter notebook or IPython environment.
- Implementing a web-based database management tool that needs to expose PostgreSQL admin commands.
- Automating database inspection tasks in scripts without reimplementing meta-command logic.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to execute PostgreSQL meta-commands programmatically.
The library is stable, has low install friction, carries a permissive license, and is actively used by established projects. The 473-day release gap is a minor concern for a mature, narrow-scope package, but verify compatibility with your PostgreSQL and psycopg versions before production use.
Install
pgspecial on PyPI
Before you install
Low friction installation with three lightweight runtime dependencies. Maintenance status is aging—last release was 473 days ago—but the package remains in use by established projects.
Requires Python >=3.9 and an active psycopg database connection.
License in practice
BSD permissive license allows use in commercial and proprietary projects with minimal restrictions, requiring only license attribution.
Quickstart
pip install pgspecial
from pgspecial.main import PGSpecial
pgspecial = PGSpecial()
for result in pgspecial.execute(cur, sql):
print(result)
Verify before relying
- Whether the 473-day gap since last release reflects stable maturity or abandonment risk for future PostgreSQL compatibility.
- Current state of the repository (archived status, recent commits) to assess ongoing maintenance.
- Compatibility with current versions of psycopg and PostgreSQL.
Package facts
| License | BSD permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesclicksqlparsepsycopg |
| Maintenance | Aging 473 days since the last release |
| First released | |
| Downloads | 650,487 / month, #5,561 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: pgspecial-2.2.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “postgres meta-commands”
- pgspecialExecutes PostgreSQL meta-commands (backslash commands)…
- llama-index-storage-docstore-postgresProvides a Postgres-backed document store integration for LlamaIndex,…
- llama-index-vector-stores-postgresIntegrates PostgreSQL with pgvector extension as a vector store…
Give your agent the search over MCP, or paste the wish link into any chat.
More Front-Ends packages
SQLAlchemy is a Python SQL toolkit and Object Relational Mapper (ORM) that provides both a high-level ORM layer for declarative object persistence and a Core SQL construction system for direct database abstraction and query building.
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Alembic generates and manages database schema migrations for SQLAlchemy applications, handling version control of database structure changes with support for upgrades, downgrades, and auto-generation from model changes.
Install it if you use SQLAlchemy and need to version-control schema changes; skip it only if you manage migrations manually or use a different ORM entirely.
A Python client library for connecting to and querying Weaviate, a vector database that enables semantic search and AI-powered data retrieval.
A Python client library that connects to Databricks clusters and SQL warehouses using a Thrift-based protocol, conforming to the Python DB API 2.0 specification and supporting Arrow-based data exchange.
Install it if you need to query Databricks clusters or SQL warehouses from Python.
Psycopg 3 is a PostgreSQL database adapter for Python that enables applications to connect to, query, and manage PostgreSQL databases using Python code.
Install it if you need to connect Python to PostgreSQL.
See also pgcli · pgdb · jupysql · pgsanity · postgres · litecli · psycopg2 · sqlalchemy-pgspider · PyPgConfig · testing.postgresql