PyGreSQL
Python PostgreSQL interfaces
What it is and what it does
PyGreSQL is a mature Python module that provides direct access to PostgreSQL databases by wrapping the lower-level libpq C library. It has been in active development since 2006 and supports Python 3.8 through 3.14 on the server side with PostgreSQL versions 12 to 18. The package offers a straightforward way to connect to a database, execute queries, and retrieve results without requiring an ORM or higher-level abstraction layer.
The package is classified as mature but shows aging maintenance signals—the last release was 201 days ago, though the repository remains active. Installation requires both the PyGreSQL package itself and the libpq system library to be present on your client machine, which adds some setup friction compared to pure-Python database drivers. It has no runtime Python dependencies, making it lightweight once installed.
Use it for:
- Direct PostgreSQL queries in scripts or applications where a lightweight, low-level interface is preferred over an ORM.
- Legacy Python codebases that already use PyGreSQL and need to remain on a maintained version.
- Systems where libpq is already available and you want to avoid additional abstraction layers.
- Database administration or reporting tools that need efficient, direct SQL execution.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyGreSQL is a Python interface to PostgreSQL databases that wraps the libpq C API, allowing direct database connections and queries from Python code.
Yes, if you need a lightweight, direct PostgreSQL interface and can manage the libpq system dependency. The package is mature and stable with no known vulnerabilities, but maintenance is aging—releases come infrequently. Suitable for established projects or where libpq is already present; consider a more actively maintained driver like psycopg if you are starting a new project or need frequent updates.
Install
pygresql on PyPI
pip
pip install pygresqluv
uv add pygresqlpoetry
poetry add pygresqlInstalling PyGreSQL
Before you install
Medium install friction due to compiled C extension and requirement for libpq system library on the client machine. Package is mature (since 2006) with aging maintenance status—last release 201 days ago, but repository remains active with recent commits.
License in practice
License treatment is marked unclear; the SPDX identifier is PostgreSQL, which is permissive, but raw license metadata is absent from the package metadata. Verify the actual license terms before adopting in proprietary or restricted contexts.
Quickstart
pip install PyGreSQL
import pygresql.pg as pg
conn = pg.connect('localhost', 'mydb', user='postgres')
result = conn.query('SELECT * FROM mytable')
conn.close()
libpq shared library must be installed and accessible on the client machine; PostgreSQL server versions 12 to 18 are supported.
Verify before relying
- Specific performance characteristics or throughput compared to other PostgreSQL adapters.
- Whether the PostgreSQL license treatment applies uniformly across all distributions or platforms.
- Current adoption rate and community activity beyond the core maintainers.
Package facts
| License | PostgreSQL (unclear) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | aging — 201 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 363,428/month — #7,221 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygresql-6.2.3-cp310-cp310-win_amd64.whl; pygresql-6.2.3-cp311-cp311-win_amd64.whl; pygresql-6.2.3-cp312-cp312-win_amd64.whl; pygresql-6.2.3-cp313-cp313-win_amd64.whl; pygresql-6.2.3-cp314-cp314-win_amd64.whl; pygresql-6.2.3-cp39-cp39-win_amd64.whl
Keywords: pygresql, postgresql, database, api, dbapi
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
psycopg2PostgreSQL database adapter for Python that…
copyleft · top 1,000 on PyPI
psycopgPsycopg 3 is a PostgreSQL database adapter for…
copyleft · top 1,000 on PyPI
psycopg2-binarypsycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
adbc-driver-postgresqlProvides a DBAPI 2.0-compatible Python…
permissive · top 5,000 on PyPI
postgresProvides a lightweight abstraction layer over…
permissive · top 15,000 on PyPI
pg8000pg8000 is a pure-Python PostgreSQL driver that…
permissive · top 1,000 on PyPI
pgdbWraps PostgreSQL connections to return query…
permissive · top 15,000 on PyPI
aws-psycopg2Provides psycopg2 with statically linked…
permissive · top 5,000 on PyPI
DBUtilsDBUtils provides pooled, persistent database…
permissive · top 5,000 on PyPI
psycopg-poolProvides a connection pool for Psycopg 3,…
copyleft · top 1,000 on PyPI