PostgreSQL driver and tools library.
Project description
py-postgresql is a set of Python modules providing interfaces to various parts of PostgreSQL. Notably, it provides a pure-Python driver + C optimizations for querying a PostgreSQL database.
http://python.projects.postgresql.org
Features:
Prepared Statement driven interfaces.
Cluster tools for creating and controlling a cluster.
Support for most PostgreSQL types: composites, arrays, numeric, lots more.
COPY support.
Sample PG-API Code:
>>> import postgresql >>> db = postgresql.open('pq://user:password@host:port/database') >>> db.execute("CREATE TABLE emp (emp_first_name text, emp_last_name text, emp_salary numeric)") >>> make_emp = db.prepare("INSERT INTO emp VALUES ($1, $2, $3)") >>> make_emp("John", "Doe", "75,322") >>> with db.xact(): ... make_emp("Jane", "Doe", "75,322") ... make_emp("Edward", "Johnson", "82,744") ...
There is a DB-API 2.0 module as well:
postgresql.driver.dbapi20
However, PG-API is recommended as it provides greater utility.
Once installed, try out the pg_python console script:
$ python3 -m postgresql.bin.pg_python -h localhost -p port -U theuser -d database_name
If a successful connection is made to the remote host, it will provide a Python console with the database connection bound to the db name.
History
py-postgresql is not yet another PostgreSQL driver, it’s been in development for years. py-postgresql is the Python 3 port of the pg_proboscis driver and integration of the other pg/python projects.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for py-postgresql-1.0.3.win32-py3.2.msi
Algorithm | Hash digest | |
---|---|---|
SHA256 | 767d60d2c049f6ed3062d1fb5f7821931dde087fa2ae78b7f59f977deec8a9d1 |
|
MD5 | 8fcdfce7a988fc43935307ded5bdc8cc |
|
BLAKE2b-256 | de7af81ccad4fb1385ec6fdb68f5d0f0b53c0e604f92ee411a8ca0edc31f821e |
Hashes for py-postgresql-1.0.3.win32-py3.1.msi
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab8c7a34763174a4b16979cd9778ccec5c9673529e08d9c0cbe24924e95a96b5 |
|
MD5 | 606e7d49d96c2a7549e216e580b368f1 |
|
BLAKE2b-256 | ee55ae3b8680d9ba0580ab1a98308aead323f00b9270ba2f46e359686439cb08 |