Tableau Connector for Google Spanner

Build 24.0.9060

Using Custom SQL Queries

Connecting to a Custom SQL Query

Tableau normally determines what query should be run against Google Spanner in order to build a visualization. However, these queries requres may request data than is needed, or you may need to use features specific to Google Spanner that Tableau does not expose. In these cases you can write a custom SQL query.

  1. After you have connected to Google Spanner, navigate to the Data Source tab.
  2. In the left pane, select your Database and Schema.
  3. Instead of selecting one of the available tables, click New Custom SQL.
  4. You are then be prompted for your query. Provide any filters aggregates or joins you want here.
  5. Click OK.

With your custom SQL query provided, proceed to Visualizing Data as if the selection were a normal table.

Native Queries

In addition to writing custom SQL queries, the connector allows you to query Google Spanner in its native query language. This is only available when QueryPassthrough is disabled.

To use a native query, follow the steps to a custom SQL query but select from the NATIVEQUERY table function instead of a table:

SELECT * FROM NATIVEQUERY('...')

It is important to remember that Google Spanner only processes the part of the query given to NATIVEQUERY. This means that other operations performed by Tableau, such as grouping and counting the results for a chart, require the connector to read all the NATIVEQUERY results and aggregate them locally.

Queries without NATIVEQUERY are not limited in this way because the connector can analyze the entire query and send as much as possible to Google Spanner. For this reason, you should use NATIVEQUERY only when necessary and limit how much data you read with it.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060