How to connect to a Datasource in Tableau
We can connect to Tableau in multiple ways. In this tutorial we will take a look in setting up both Basic as well as Advanced connection types.
To begin analyzing your data, first connect Tableau to one or more data sources. A data source can be as simple as an Excel workbook, or as elaborate as a SQL Server or Oracle data warehouse. After connecting, the data fields become available in the Data window on the left side of the workbook. This section describes the types of data supported and how to create and maintain a basic connection.
Supported Data Sources
Tableau supports a wide variety of data sources, including Microsoft Office files, SQL databases, comma delimited text files, and multi-dimensional databases.
How to Connect to a Data Source
To build views of your data, you must first connect Tableau to a data source.
You can connect to any supported data source with the Connect to Data dialog box.
Select Data > Connect to Data or press Ctrl + D on your keyboard. You can also select the Connect to Data option on the start page.
On the Connect to Data page, select the type of data you want to connect to. You can also select a saved data connection (TDS files) open a Tableau Server Data Source.
Interested in mastering Tableau? Enroll now FREE demo on Tableau Training and become Tableau Developer.
A data source-specific dialog box opens that allows you to complete the connection process.
Another way to connect to data is to import from a workbook. A workbook can contain multiple worksheets, each of which can be connected to a different data source. To import a connection from a workbook click the Import from Workbook button at the bottom of the Select Saved Connection tab in the Connect to Data dialog box.
After the connection is established, the data source fields display on the left side of the workbook in the Data window.
Connecting to a Custom SQL Query
Relational data sources you can connect to a specific query rather then the entire data source. Often this can be useful when you know exactly the information you need and you understand how to write SQL queries.
- Select Custom SQL in the connection dialog box.
- Type or paste the query into the text box. The button in the upper right corner of the text box opens a larger editing window for more complex queries.
When you finish the connection, only the relevant fields display in the Tableau Data window.
If your SQL query references duplicate columns, you may get errors when trying to use one of the columns in Tableau. This will happen even if the query is valid. For example, consider the following query:
SELECT * from authors, titleauthor where authors.au_id = titleauthor.au_id
The query is valid, but the au_id field is ambiguous because it exists in both the “authors” table and the “titleauthor” table. Tableau will connect to the query but you will get an error anytime you try to use the au_id field. That’s because Tableau doesn't know which table you are referring to.
For indepth knowledge on Tableau, click on below