简体   繁体   English

postgresql pg_dump *的python api,恢复命令

[英]python api for postgresql pg_dump*, restore commands

Is there a python library that contains the functionality of the pg_dump, pg_dumpall and restore commands? 是否有一个包含pg_dump,pg_dumpall和restore命令功能的python库? I want to have the ability to handle exceptions where the standard commands do not allow for that level of control. 我希望能够处理标准命令不允许该级别控制的异常。

Is there anything out here that can help me? 这里有什么可以帮助我吗?

You could try psycopg2 . 你可以试试psycopg2 It's a python api to postgres, and you can use the copy_from and copy_to methods on the cursor to do it with StringIO objects and do it all in memory, or just with the disk. 它是postgres的python api,你可以使用游标上的copy_fromcopy_to方法来处理StringIO对象,并在内存中完成所有操作,或者只使用磁盘。

This is only good for data though, i believe. 我相信这只对数据有利。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM