AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Data Studio
2K members online now
2K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

Bug Report: "Internal Error"s with BigQuery data source when last line of query is commented out

Explorer ✭ ☆ ☆
# 1
Explorer ✭ ☆ ☆

If you've got a BigQuery data source hooked up inside DS, and the last line of your query is commented out, you'll see an "Internal Error" message when trying to load visualizations with that data source.

 

This is happening because DS inserts a "wrapper" outer query around your actual query. If this is your original query...

 

SELECT
  field1,
  field2,
  ...
FROM
  your_dataset.your_table

 

...then Data Studio will run this query when you load a visualization:

 

SELECT t0.field1, t0.field2, .... FROM (SELECT
  field1,
  field2,
  ...
FROM
  your_dataset.your_table) AS t0

If you happen to have the very last line of your query commented out (for whatever reason), then DS will try to run this query:

 

SELECT t0.field1, t0.field2, .... FROM (SELECT
  field1,
  field2,
  ...
FROM
  your_dataset.your_table
-- comment here ) AS t0

DS appends the closing part of its outer query to the last line. If that line has a comment, DS's outer query throws an error. Specifically, you'll see "Encountered "<EOF>" at line X, column Y. Was expecting: ")" "

 

Perhaps DS could throw the outer query closing SQL onto a new line at the end of the source query? Seems like that would fix the issue.