CLJ
CLJ

Reputation: 1927

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? 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?

Upvotes: 8

Views: 1801

Answers (1)

notbad.jpeg
notbad.jpeg

Reputation: 3368

You could try 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.

This is only good for data though, i believe.

Upvotes: 1

Related Questions