Search code examples
google-bigquerygoogle-cloud-sql

Is it possible to join cloud sql table to bigquery?


I have a large amount of data in bigquery and I want to do some analysis that would be enhanced by doing a join to a small set of data I have in cloud sql. I've search but cannot find a sql based bridge between the two. I was thinking something like this:

SELECT
  bqdb.table as a,
  csdb.table as b,
  csdb.table as c
FROM bigquery:project:bqdb.table as t1,cloudsql:project:csdb.table as t2
JOIN t1 ON t1.a=t2.b
WHERE a='foo'
GROUP BY a,b
ORDER BY c

Solution

  • There's not currently a direct bridge between data in Cloud SQL and Google BigQuery. In order to run a query like this, you will need to export your Cloud SQL table data in CSV format via the mysqldump tool, and then import this data into BigQuery as a new table.