Skip to content

Commit 97ce7b8

Browse files
author
James William Pye
committed
Minor cleanups.
1 parent a619d0a commit 97ce7b8

4 files changed

Lines changed: 20 additions & 9 deletions

File tree

README

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ The documentation package, `postgresql.documentation.index`, contains more
4343
detailed information on the modules herein, and HTML versions of the
4444
documentation can be found at::
4545

46+
4647
http://python.projects.postgresql.org
4748

49+
4850
Or, you can read them in your pager: python -m postgresql.documentation.index

postgresql/documentation/driver.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
version 3.0 of the PQ protocol *should* work, many features may not work due to
1818
absent functionality in the remote end.
1919
20+
For DB-API 2.0 users, the driver module is located at
21+
`postgresql.driver.dbapi20`.
22+
2023
.. note::
2124
PostgreSQL versions 8.1 and earlier do not support standard conforming
2225
strings. A warning will be raised whenever a connection is established to a

postgresql/documentation/index.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
=============
99
1010
py-postgresql is a project dedicated to improving the Python interfaces to
11-
PostgreSQL.
11+
PostgreSQL. It strives to provide substantial convenience to Python programmers
12+
using PostgreSQL.
1213
1314
At its core, py-postgresql provides a PG-API, `postgresql.api`, and
14-
DB-API 2.0 interface for accessing a PostgreSQL database.
15+
DB-API 2.0 interface for using a PostgreSQL database.
1516
1617
--------
1718
Contents
@@ -40,27 +41,29 @@
4041
Sample PG-API Code
4142
------------------
4243
44+
Using `postgresql.driver`::
45+
4346
>>> import postgresql
4447
>>> db = postgresql.open("pq://user:password@host/name_of_database")
4548
>>> db.execute("CREATE TABLE emp (emp_name text PRIMARY KEY, emp_salary numeric)")
46-
>>>
49+
>>>
4750
>>> # Create the statements.
4851
>>> make_emp = db.prepare("INSERT INTO emp VALUES ($1, $2)")
4952
>>> raise_emp = db.prepare("UPDATE emp SET emp_salary = emp_salary + $2 WHERE emp_name = $1")
5053
>>> get_emp_with_salary_lt = db.prepare("SELECT emp_name FROM emp WHERE emp_salay < $1")
51-
>>>
54+
>>>
5255
>>> # Create some employees, but do it in a transaction--all or nothing.
5356
>>> with db.xact():
5457
... make_emp("John Doe", "150,000")
5558
... make_emp("Jane Doe", "150,000")
5659
... make_emp("Andrew Doe", "55,000")
5760
... make_emp("Susan Doe", "60,000")
58-
>>>
61+
>>>
5962
>>> # Give some raises
6063
>>> with db.xact():
6164
... for row in get_emp_with_salary_lt("125,000"):
62-
... print(row["emp_name"])
63-
... raise_emp(row["emp_name"], "10,000")
65+
... print(row["emp_name"])
66+
... raise_emp(row["emp_name"], "10,000")
6467
6568
6669
Of course, if DB-API 2.0 is desired, the module is located at

sphinx-src/index.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ py-postgresql
22
=============
33

44
py-postgresql is a project dedicated to improving the Python interfaces to
5-
PostgreSQL.
5+
PostgreSQL. It strives to provide substantial convenience to Python programmers
6+
using PostgreSQL.
67

78
At its core, py-postgresql provides a PG-API, `postgresql.api`, and
8-
DB-API 2.0 interface for accessing a PostgreSQL database.
9+
DB-API 2.0 interface for using a PostgreSQL database.
910

1011

1112
Contents
@@ -25,6 +26,8 @@ Contents
2526
Sample PG-API Code
2627
------------------
2728

29+
Using `postgresql.driver`::
30+
2831
>>> import postgresql
2932
>>> db = postgresql.open("pq://user:password@host/name_of_database")
3033
>>> db.execute("CREATE TABLE emp (emp_name text PRIMARY KEY, emp_salary numeric)")

0 commit comments

Comments
 (0)