P A
P A

Reputation: 11

Importing and Exporting Data from Google Cloud SQL Database

I am having a hard time setting up a database in Google Cloud SQL. As of right now I have database created with a table for "Students". What I don't understand is how to view the data and/or how to import data from an API into this database.

I've tried fetching all the data from an API and using INSERT in a data.sql file, but this has proven to be immensely slow and inefficient

I expect that there is a way to directly gather API data and insert it into the cloud database, but I have not found a way to do this yet.

Upvotes: 1

Views: 2745

Answers (1)

Chris32
Chris32

Reputation: 4961

To view the data in your database you can ssh into your Cloud SQL instance following this Quickstart for Cloud SQL for MySQL guide. To select your database when you reach this point in the guide Just use the command USE <Your database name>; to select the database that you already created. Then you can do a SELECT * FROM <yourTable>; to see your data.

After that in order to use the Cloud SQL REST API to import data into your database, you can follow this Importing data into Cloud SQL guide. Here you will be able to import your data.sql from a bucket (which is the fastest way to import data into your database).

To export data from your database you can also follow this Exporting data from Cloud SQL guide.

Upvotes: 1

Related Questions