欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
PyPgSQL
来自开放百科 - 灰狐
(版本间的差异)
第1行: | 第1行: | ||
+ | pyPgSQL is a package of two modules that provide a Python DB-API 2.0 compliant interface to PostgreSQL databases. The first module, libpq, exports the PostgreSQL C API to Python. This module is written in C and can be compiled into Python or can be dynamically loaded on demand. The second module, PgSQL, provides the DB-API 2.0 compliant interface and support for various PostgreSQL data types, such as INT8, NUMERIC, MONEY, BOOL, ARRAYS, etc. This module is written in Python. | ||
+ | |||
+ | http://pypgsql.sourceforge.net/ | ||
+ | |||
Debian | Debian | ||
#apt-get install python2.3-pgsql | #apt-get install python2.3-pgsql |
2007年3月7日 (三) 15:04的最后版本
pyPgSQL is a package of two modules that provide a Python DB-API 2.0 compliant interface to PostgreSQL databases. The first module, libpq, exports the PostgreSQL C API to Python. This module is written in C and can be compiled into Python or can be dynamically loaded on demand. The second module, PgSQL, provides the DB-API 2.0 compliant interface and support for various PostgreSQL data types, such as INT8, NUMERIC, MONEY, BOOL, ARRAYS, etc. This module is written in Python.
http://pypgsql.sourceforge.net/
Debian
#apt-get install python2.3-pgsql su postgres createdb test python >>> from pyPgSQL import PgSQL >>> cx = PgSQL.connect(database="test", client_encoding="utf-8", unicode_results=1) >>> cu = cx.cursor() >>> cu.execute("set client_encoding to unicode") >>> cu.execute("insert into test(v) values (%s)", (u'\x99sterreich',)) >>> cu.execute("select v from test") >>> cu.fetchone() [u'\x99sterreich'] >>>
分享您的观点