/usr/share/doc/python3-postgresql/html/_sources/index.txt is in python3-postgresql 1.1.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | py-postgresql
=============
py-postgresql is a project dedicated to improving the Python client interfaces to PostgreSQL.
At its core, py-postgresql provides a PG-API, `postgresql.api`, and
DB-API 2.0 interface for using a PostgreSQL database.
Contents
--------
.. toctree::
:maxdepth: 2
admin
driver
copyman
notifyman
alock
cluster
lib
clientparameters
gotchas
Reference
---------
.. toctree::
:maxdepth: 2
bin
reference
Changes
-------
.. toctree::
:maxdepth: 1
changes-v1.1
changes-v1.0
Sample Code
-----------
Using `postgresql.driver`::
>>> import postgresql
>>> db = postgresql.open("pq://user:password@host/name_of_database")
>>> db.execute("CREATE TABLE emp (emp_name text PRIMARY KEY, emp_salary numeric)")
>>>
>>> # Create the statements.
>>> make_emp = db.prepare("INSERT INTO emp VALUES ($1, $2)")
>>> raise_emp = db.prepare("UPDATE emp SET emp_salary = emp_salary + $2 WHERE emp_name = $1")
>>> get_emp_with_salary_lt = db.prepare("SELECT emp_name FROM emp WHERE emp_salay < $1")
>>>
>>> # Create some employees, but do it in a transaction--all or nothing.
>>> with db.xact():
... make_emp("John Doe", "150,000")
... make_emp("Jane Doe", "150,000")
... make_emp("Andrew Doe", "55,000")
... make_emp("Susan Doe", "60,000")
>>>
>>> # Give some raises
>>> with db.xact():
... for row in get_emp_with_salary_lt("125,000"):
... print(row["emp_name"])
... raise_emp(row["emp_name"], "10,000")
Of course, if DB-API 2.0 is desired, the module is located at
`postgresql.driver.dbapi20`. DB-API extends PG-API, so the features
illustrated above are available on DB-API connections.
See :ref:`db_interface` for more information.
|