Using Custom SQL Queries
Connecting to a Custom SQL Query
Tableau normally determines what query should be run against 1010Data 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 1010Data that Tableau does not expose. In these cases you can write a custom SQL query.
- After you have connected to 1010Data, navigate to the Data Source tab.
- In the left pane, select your Database and Schema.
- Instead of selecting one of the available tables, click the New Custom SQL button.
- You will then be prompted for your query. Provide any filters aggregates or joins you want here.
- Click OK.
With your custom SQL query provided, you can now proceed to Visualizing Data as if the selection were a normal table.
Native Queries
In addition to writing custom SQL queries, the connector also allows you to query 1010Data 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 1010Data 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 1010Data. For this reason, you should use NATIVEQUERY only when necessary and limit how much data you read with it.