How to read postgresql dump file in Python

Posted by xorsyst on Stack Overflow See other posts from Stack Overflow or by xorsyst
Published on 2013-10-28T14:53:31Z Indexed on 2013/10/31 9:54 UTC
Read the original article Hit count: 267

Filed under:
|

I'd like my Python script to read some data out of a postgresql dump file. The Python will be running on a system without postgresql, and needs to process the data in a dump file.

It looks fairly straightforward to parse the CREATE TABLE calls to find the column names, then the INSERT INTO rows to build the contents. But I'm sure there would be quite a few gotchas in doing this reliably. Does anyone know of a module which will do this?

© Stack Overflow or respective owner

Related posts about python

Related posts about postgresql