google-bigquerygoogle-cloud-sql

Best way to import Google Cloud SQL data into BigQuery


I have a database in a Cloud SQL instance. I would like to copy its content into BigQuery in order to perform analysis. It is not a requirement for me to continuously update the BigQuery dataset. It is OK if the export is done only once.

What is the best way to achieve this?

The 'Create Table' BigQuery UI does not allow me to import from Cloud SQL (only File, Cloud Storage, Drive or BigTable).


Solution

  • Up to now, there is no automated tool to import data into BigQuery from Cloud SQL, so a procedure you can follow consists in:

    1. Export the data from the table you want in your Cloud SQL instance in CSV format, as explained in the documentation.
    2. Import the CSV data into the BigQuery table you want following the procedure also explained in the documentation.

    You are done. If your database is large and has many tables, you may want to do the import programatically, using the API.