PostgreSQL驱动程序和工具库。

py-postgresql的Python项目详细描述


py postgresql是一组python模块,为各个部分提供接口 关于PostgreSQL。值得注意的是,它为 查询PostgreSQL数据库。

http://python.projects.postgresql.org

功能:

  • Prepared Statement driven interfaces.
  • Cluster tools for creating and controlling a cluster.
  • Support for most PostgreSQL types: composites, arrays, numeric, lots more.
  • COPY support.

PG-API代码示例:

>>> import postgresql
>>> db = postgresql.open('pq://user:password@host:port/database')
>>> db.execute("CREATE TABLE emp (emp_first_name text, emp_last_name text, emp_salary numeric)")
>>> make_emp = db.prepare("INSERT INTO emp VALUES ($1, $2, $3)")
>>> make_emp("John", "Doe", "75,322")
>>> with db.xact():
...  make_emp("Jane", "Doe", "75,322")
...  make_emp("Edward", "Johnson", "82,744")
...

还有一个DB-API 2.0模块:

postgresql.driver.dbapi20

但是,建议使用PG-API,因为它提供了更大的实用性。

安装后,请尝试pg_python控制台脚本:

$ python3 -m postgresql.bin.pg_python -h localhost -p port -U theuser -d database_name

如果成功连接到远程主机,它将提供一个python 数据库连接绑定到db名称的控制台。

历史记录

py postgresql还不是另一个postgresql驱动程序,它是为 年。py postgresql是pg_proboscis驱动程序的python 3端口,并且 其他pg/python项目的集成。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
正则表达式使用Java从服务器截断文本   micronaut微服务的java内存消耗   如果私有函数需要相同的输入,java应该在公共函数中显式执行异常检查   为什么我们在java中使用抽象类和抽象方法   Java中接受外来字母的字符串?   cordova Android:ClassNotFoundException,包括ZXing   通过LiveData observer向特定索引添加项时出现java IndexOutOfBoundsException   jsp Java从两个源调用一个servlet   java如何设置网格布局中按钮的位置?   java HashMap返回方法   java JDK错误版本   java如何将现有类集成到新的Swing项目中   java如何在扫描程序位于输入端时使for循环停止   java正则表达式匹配空白表   java组织。格拉德尔。工具。BuildException:设置的代码长度无效   JList中的swing Java格式化字符串   javabeans如何将JavaBean属性映射到另一个名称以进行输出?   ajax请求后的java Rerender RichFaces错误消息