简体   繁体   中英

Import compressed SQL dump into Postgresql with python

I have to import a compressed sql dump into a PostgreSQL database. The dump gets created by:

pg_dump -F c

So I get a compressed file, which I can't just parse line by line and then use psycopg2 to upload it into my database.

The compressed dumps I'm dealing with are quite big (up to 10GB). What would be an efficient way to do import them?

You basically can't do that unless you reimplement pg_restore in your Python project. Consider instead calling pg_restore from your Python program.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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