psycopg2
Popular PostgreSQL adapter for Python with full database access and query execution.
2. Maintained
github.com/psycopg/psycopg23. Used by agents' projects
Dependency in 99 public GitHub projects set up for AI coding agents that we scanned (1.6%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What psycopg2 does
Popular PostgreSQL adapter for Python with full database access and query execution.
psycopg2 popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How psycopg2 is used
- psycopg2 is a dependency in 99 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (6.1% of the 1,623 Python ones), #7 of 120 in databases, orms and clients.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 664; those are left out of every share on this page.
- The most used alternative in our scan is SQLAlchemy (181 projects).
- Projects that use it most often also use python-dotenv (72.7%), Uvicorn (63.6%), FastAPI (61.6%).
By coding agent
Often used with
More about psycopg2
Funding
- GitHub Sponsors: https://github.com/dvarrazzo
- Own page: https://www.paypal.me/dvarrazzo
- 30 GitHub sponsors
Head to head
- psycopg2 vs asyncpg used together in 24 projects
More in Databases, ORMs and clients
Alternatives
psycopg2 This page
Python SQL toolkit and object-relational mapper for database abstraction.
Fast asyncio PostgreSQL driver for non-blocking database operations in Python.
Pure Python MySQL database driver for database operations.
Official Python driver for Neo4j graph database with Bolt protocol.
Official MongoDB Python driver for querying and managing MongoDB databases.
Get started
Install it.
pip install psycopg2-binaryNo step-by-step start for psycopg2 yet: we have not written its hand-checked card.