Reputation: 1746
I have 5GB SQL dump and I want to import that to Postgres. I have one problem in SQL dump that is CREATE TABLE IF EXISTS
. This is invalid in Postgres. I am unable to remove this line from that dump because that is huge in SIZE (5GB).
I am doing all these in Google Cloud. If there is any way to migrate from Google SQL to Postgres that will also work for me.
Upvotes: 0
Views: 169
Reputation: 1917
As described in this article, you can export your data to a PostgreSQL dump using the pg_dump
command. Command:
pg_dump -U [USERNAME] --format=plain --no-owner --no-acl [DATABASE_NAME] | sed -E 's/(DROP|CREATE|COMMENT ON) EXTENSION/-- \1 EXTENSION/g' > [SQL_FILE].sql
Upvotes: 1