KNOWLEDGE BASE

Using UNION to Combine Data in Google BigQuery


Published: 05 Mar 2013
Last Modified Date: 23 May 2016

Question

How to use the UNION operator to combine data in a Google BigQuery data source.

Environment

  • Tableau Desktop
  • Google BigQuery data source

Answer

Use one of the following workarounds:

Option 1

Run the query in BigQuery, save the resulting table, and then connect to that table.

Option 2

Append extracts in Tableau Desktop to combine data sets. Navigate to Data > <connection name> > Extract > Add Data from File....
 

Additional Information

  • UNION functionality in Google BigQuery is not currently supported in the BigQuery connector.
  • Syntax for the UNION operator is different in Google BigQuery than in standard SQL.
    • Typical SQL UNION: 
      SELECT <column name(s)> FROM <tableA> 
      UNION 
      SELECT <column name(s)> FROM <tableB>
    • BigQuery Union:
      SELECT <field name(s)> from <project>:<dataset>.<tableA>, <project>:<dataset>.<tableB>
 
Query Reference from Google Developers guide
Did this article resolve the issue?