简体   繁体   中英

Google Data Studio report using Cloud SQL MySQL allows only one table

I'm using Data Studio to generate a financial report dashboard and I'm connecting it to CloudSQL MySQL, but my problem here is that it only requires me one table to use as a data source, and one table wouldn't help me at all to generate a financial report at all.

Here's the image of the process of selecting a Data Source:

I tried selecting Custom Query, which according to this: https://support.google.com/datastudio/answer/7088031?hl=en

Select the CUSTOM QUERY option to provide a SQL query instead of connecting to a single table. Google Data Studio uses this custom SQL as an inner select statement for each generated query to the database.

But I don't know what query should I write to have all my database tables as data sources in Google Data Studio.

Regarding Custom Queries : Had a look online, and didn't seem to find a sample CUSTOM QUERY specific to Google Data Studio and Google Cloud SQL for MySQL , however, on StackOverflow, there are a couple of posts on BigQuery Custom Queries that involve joins, that may be useful:

An alternative is to create individual Data Sources each linked to a single table and then link multiple Data Sources through the use of Data Blending , where a common Join Key links all the respective Tables.

In addition, if you could elaborate on your exact scenario, it would perhaps help users familiar with SQL to provide a more precise solution:

  • How are the tables structured?
  • How are the tables linked?
  • What code have you currently tried?

I also had quite a few issues with the Custom Query using the Cloud MySQL Connector by Google for Data Studio.

The resolution for me was to not run SELECT * but rather SELECT each column by name. Not sure why it doesn't like SELECT * but hopefully this helps someone else.

Example of a successful query.

在此处输入图像描述

Example of successful query with join.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM