Connecting to a Custom SQL Query

For most 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.
  1. Select Custom SQL in the connection dialog box.
  2. 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.

23 comments:

  1. This concept is a good way to enhance the knowledge.thanks for sharing. please keep it up salesforce Online Training Bangalore

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi, I would like to check if it is possible to restrict users' access to the original data sources e.g. two tables. Instead I will write a custom SQL that reads data from these two base tables to restrict the columns and also add some calculated fields. Is this possible?
    i.e. allow access to custom sql but not base tables in Tableau. Appreciate your sharing and advice. Thank you.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Wow,I think this is a very good and informative post about Tableau.

    Tableau Rest Api Connection

    ReplyDelete
  6. Hey there, thanks for sharing this informational article. If you are looking for ways to learn tableau then click here to find out how.

    ReplyDelete
  7. I just loved your article on the beginners guide to starting a blog.If somebody take this blog article seriously in their life, he/she can earn his living by doing blogging.thank you for thizs article. devops online training

    ReplyDelete
  8. Really thanks for posting such an useful and informative stuff..

    Salesforce Training Online

    ReplyDelete
  9. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    microservices online training
    best microservices online training
    top microservices online training

    ReplyDelete
  10. Thanks for your valuable information. Its very good article.
    servicenow training
    servicenow certification

    ReplyDelete
  11. Thank you for sharing such an amazing write-up with us!
    Workday Payroll Training

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Thank you for sharing wonderful information with us to get some idea about it.
    Oracle OSB Training
    soa Online Training Hyderabad

    ReplyDelete
  14. Thank you for sharing wonderful information with us to get some idea about it.

    tableau online training

    ReplyDelete