欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2/Agda, C++/Lisp/Haskell
PyGreSQL
来自开放百科 - 灰狐
(版本间的差异)
| 第4行: | 第4行: | ||
http://www.pygresql.org/ | http://www.pygresql.org/ | ||
| + | |||
| + | ==Install== | ||
| + | #apt-get install python2.3-pygresql | ||
| + | |||
| + | #su postgresql | ||
| + | postgres$ python | ||
| + | >>> import _pg | ||
| + | >>> db = _pg.connect('dellstore2','localhost') | ||
| + | >>> db.query("select * from categories") | ||
| + | category|categoryname | ||
| + | --------+------------ | ||
| + | 1|Action | ||
| + | 2|Animation | ||
| + | 3|Children | ||
| + | 4|Classics | ||
| + | 5|Comedy | ||
| + | 6|Documentary | ||
| + | 7|Drama | ||
| + | 8|Family | ||
| + | 9|Foreign | ||
| + | 10|Games | ||
| + | 11|Horror | ||
| + | 12|Music | ||
| + | 13|New | ||
| + | 14|Sci-Fi | ||
| + | 15|Sports | ||
| + | 16|Travel | ||
| + | (16 rows) | ||
| + | |||
| + | (1 row) | ||
2007年3月21日 (三) 22:34的版本
PyGreSQL – PostgreSQL module for Python
It embeds the PostgreSQL query library to allow easy use of the powerful PostgreSQL features from a Python script.
Install
#apt-get install python2.3-pygresql
#su postgresql
postgres$ python
>>> import _pg
>>> db = _pg.connect('dellstore2','localhost')
>>> db.query("select * from categories")
category|categoryname
--------+------------
1|Action
2|Animation
3|Children
4|Classics
5|Comedy
6|Documentary
7|Drama
8|Family
9|Foreign
10|Games
11|Horror
12|Music
13|New
14|Sci-Fi
15|Sports
16|Travel
(16 rows)
(1 row)
分享您的观点