Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

I have a BigQuery database where daily data is uploaded into its own table. So I have tables named "20131201", "20131202", etc. I can write a fixed query to "merge" those tables by doing:

SELECT * FROM db.20131201, db.20131202, ...

I'd like to have a single query that does not require me to update the Custom SQL every time a new table is added. Something like:

SELECT * FROM db.*

Which currently doesn't work. I would like to avoid making one giant table. Is there a work-around that I can do, or will this have to be a feature request?

End-goal is for a Tableau data connection to all the tables.

1 Answer

0 votes
by (47.2k points)
  • Refer to this link for help:

https://cloud.google.com/bigquery/docs/reference/legacy-sql#tablewildcardfunctions

  • Using TABLE_DATE_RANGE(prefix, timestamp1, timestamp2), we can achieve a similar result for use in tableau. You will still have to provide 2 date parameters but it is substantially better than dynamically generating the FROM clause.

Browse Categories

...