0
votes

I downloaded the postgresql .dmp file from the chembl database.

I want to import this into gcp cloudsql.

When I run it with the console and gcloud command, I get the following error:

Importing data into Cloud SQL instance...failed.
ERROR: (gcloud.sql.import.sql) [ERROR_RDBMS] exit status 1
The input is a PostgreSQL custom-format dump.
Use the pg_restore command-line client to restore this dump to a database.

Can I import custom-format dmp files without using the pg_restore command?

https://cloud.google.com/sql/docs/postgres/import-export/importing

There is a description of pg_restore in the document on that site, but I didn't get it right.

In the case of custom-format files, is it necessary to pg_restore after uploading them to the cloud shell?

1

1 Answers

1
votes

According to the CloudSQL docs:

Only plain SQL format is supported by the Cloud SQL Admin API.

The custom format is allowed if the dump file is intended for use with pg_restore.

If you cannot use pg_restore for some reason, I would spin up a local Postgres instance (i.e., on your laptop) and use pg_restore to restore the database.

After loading into your local database, you can use pg_dump to dump to file in plaintext format, then load into CloudSQL with the console or gcloud command.