Kai
Kai

Reputation: 2325

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?

Upvotes: 2

Views: 1518

Answers (1)

Peter Eisentraut
Peter Eisentraut

Reputation: 36779

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

Upvotes: 2

Related Questions