1- About
2- =====
1+ # About
32
43py-postgresql is a Python 3 package providing modules for working with PostgreSQL.
54This includes a high-level driver, and many other tools that support a developer
@@ -11,55 +10,41 @@ http://github.com/MagicStack/asyncpg should be considered.
1110py-postgresql, currently, does not have direct support for high-level async
1211interfaces provided by recent versions of Python. Future versions may change this.
1312
14- Errata
15- ------
13+ # Errata
1614
17- .. warning::
18- In v1.3, `postgresql.driver.dbapi20.connect` will now raise `ClientCannotConnectError` directly.
19- Exception traps around connect should still function, but the `__context__` attribute
20- on the error instance will be `None` in the usual failure case as it is no longer
21- incorrectly chained. Trapping `ClientCannotConnectError` ahead of `Error` should
22- allow both cases to co-exist in the event that data is being extracted from
23- the `ClientCannotConnectError`.
15+ In v1.3, `postgresql.driver.dbapi20.connect` will now raise `ClientCannotConnectError` directly.
16+ Exception traps around connect should still function, but the `__context__` attribute
17+ on the error instance will be `None` in the usual failure case as it is no longer
18+ incorrectly chained. Trapping `ClientCannotConnectError` ahead of `Error` should
19+ allow both cases to co-exist in the event that data is being extracted from
20+ the `ClientCannotConnectError`.
2421
25- Installation
26- ------------
22+ # Installation
2723
28- Installation *should* be as simple as::
24+ Installation *should* be as simple as:
2925
3026 $ python3 ./setup.py install
3127
32- More information about installation is available via: :
28+ Or :
3329
34- python -m postgresql.documentation.admin
30+ $ pip install py- postgresql
3531
36- Basic Driver Usage
37- ------------------
32+ # Basic Driver Usage
3833
39- Using PG-API::
34+ ```python
35+ import postgresql
36+ db = postgresql.open('pq://user:password@host:port/database')
37+ get_table = db.prepare("select * from information_schema.tables where table_name = $1")
38+ for x in get_table("tables"):
39+ print(x)
40+ print(get_table.first("tables"))
41+ ```
4042
41- >>> import postgresql
42- >>> db = postgresql.open('pq://user:password@host:port/database')
43- >>> get_table = db.prepare("select * from information_schema.tables where table_name = $1")
44- >>> for x in get_table("tables"):
45- >>> print(x)
46- >>> print(get_table.first("tables"))
43+ # Documentation
4744
48- However, a DB-API 2.0 driver is provided as well: ` postgresql.driver.dbapi20`.
45+ http://py- postgresql.readthedocs.io
4946
50- Further Information
51- -------------------
47+ # Related
5248
53- Online documentation can be retrieved from:
54-
55- http://py-postgresql.readthedocs.io
56-
57- Or, you can read them in your pager: python -m postgresql.documentation.index
58-
59- For information about PostgreSQL:
60-
61- http://postgresql.org
62-
63- For information about Python:
64-
65- http://python.org
49+ - http://postgresql.org
50+ - http://python.org
0 commit comments