SkyWalker
SkyWalker

Reputation: 14307

Is there an alternative way to import data into Postgres than using psql?

I am under strict corporate environment and don't have access to Postgres' psql. Therefore I can't do what's shown e.g. in the SO Convert SQLITE SQL dump file to POSTGRESQL. However, I can generate the sqlite dump file .sql. The resulting dump.sql file is 1.3gb big.

What would be the best way to import this data into Postgres? I also have DBeaver and can connect to both databases simultaneously but unfortunately can't do INSERT from SELECT.

Upvotes: 0

Views: 978

Answers (3)

jjanes
jjanes

Reputation: 44305

If you can install psycopg2 or pg8000 for python, you should be able to connect to the database and then loop over the dump file sending each line to the database with cur.execute(line) . It might take some fiddling if the dump file has any multi-line commands, but the example you linked to doesn't show any of those.

Upvotes: 1

bfris
bfris

Reputation: 5825

EnterpriseDB offers binary downloads. If you unzip those to a local drive you might be able to execute psql from the bin subdirectory.

Upvotes: 1

jjanes
jjanes

Reputation: 44305

I think the term for that is 'absurd', not 'strict'.

DBeaver has an 'execute script' feature. But who knows, maybe it will be blocked.

Upvotes: 2

Related Questions