py-postgresqlPostgreSQL driver and tools library | |
Download |
py-postgresql Ranking & Summary
Advertisement
- License:
- BSD License
- Price:
- FREE
- Publisher Name:
- James William Pye
- Publisher web site:
- http://python.projects.postgresql.org/
py-postgresql Tags
py-postgresql Description
PostgreSQL driver and tools library py-postgresql is a set of Python library 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.orgSample 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.dbapi20However, PG-API is recommended as it provides greater utility.Once installed, try out the pg_python console script:$ pg_python -h localhost -p port -U theuser -d database_nameIf a successful connection is made to the remote host, it will provide a Python console with the database connection bound to the db name. Here are some key features of "py-postgresql": · Prepared Statement driven interfaces. · Cluster tools for creating and controlling a cluster. · Support for most PostgreSQL types: composites, arrays, numeric, lots more. · COPY support. Requirements: · Python
py-postgresql Related Software