python-postgres/fe
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
About py-postgresql
===================
py-postgresql is a Python 3 package providing modules to work with PostgreSQL.
This includes a high-level driver, and many other tools that support a developer
working with PostgreSQL databases.
The goal of this project is to provide substantial convenience to Python
developers working with PostgreSQL.
Installation
------------
Installation should be as simple as::
$ python3.0 ./setup.py install
Further information is located in postgresql/documentation/install.txt.
Basic Driver Usage
------------------
Using PG-API is recommended as it provides more utility for the user. However, a
DB-API 2.0 driver is provided: `postgresql.driver.dbapi20`.
Sample PG-API Code
^^^^^^^^^^^^^^^^^^
import postgreql.driver as pg_driver
# Alter the parameters accordingly
db = pg_driver.connect(user = 'myuser', host = 'localhost', port = 5432, database = 'mydbname', password = 'secret')
# create a prepared statement
get_table = db.prepare("select * from information_schema.tables where table_name = $1")
for x in get_table("tables"):
print(x)
print(get_table.first("tables"))
Further Information
-------------------
The documentation directory, `postgresql/documentation`, contains more detailed
information on the modules herein, and HTML versions of the documentation can
be found at::
http://python.projects.postgresql.org