Alternative drivers for PostgreSQL
In this section, we will take a closer look at two other PostgreSQL libraries for Python. The first one, pg8000
, also implements the DB API 2.0. This makes it very similar to psycopg2
. The difference though is that it is not dependent on the library ligpq
and is written entirely in Python. This makes the library very lightweight and applications, that would use it, easily portable.
The second one, asyncpg
, does not implement the Python DB API. It uses a binary protocol to communicate with a PostgreSQL database and asynchronous API in the applications. This makes it possible to create very fast database applications performing great amounts of commands in a short time.
pg8000
To install the library pg8000
, one should use pip
in the same way as with psycopg2
. Here is an example of how it looks in Windows:
c:\Users\user>python -m pip install pg8000 Collecting pg8000 Downloading pg8000-1.11.0-py2.py3-none-any.whl Collecting six>=1.10.0 (from pg8000) Downloading...