Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download underlying data #102

Open
adeekhan opened this issue Oct 16, 2022 · 4 comments
Open

Download underlying data #102

adeekhan opened this issue Oct 16, 2022 · 4 comments

Comments

@adeekhan
Copy link

Hi,
I have used tableau_api_lib, using which I can query, site, workbook and view. However there are two issues I have:

  1. I have used get_view_data_dataframe() and query_view_data() , which downloads the default view data, howevery not able to download the underlying data. I am after downloading the underlying data of the view similar to which I can do from Tableau Download>Data option.
  2. Using parameter_dict option in above function I cannot filter it, only one filter worked the others dont. I have followed the following video to understand its usage:

https://www.youtube.com/watch?v=Cxug64ICQmg

I would highly appreciate if you can help to fixed the above issues. You can reach out to me on my email ID [email protected] if you wish to reach out to me directly.

Thank you once again for creating such a great library however would appreciate if you can help me find the solution of above issues.

@divinorum-webb
Copy link
Owner

Hey @adeekhan let's dig into this a bit further.

  1. Are you saying that you do not want to query the view data as summarized in the Tableau view, but rather you want to query the underlying database directly?
  2. Do the filter names or values you are using in your parameter_dict have non-URL friendly characters in them? If the fields or values you are filtering on have characters such as " " (blank space) then you need to convert the values to how they would be represented properly in a URL. You can use the urllib.parse.quote function to do so. For example, if you were filtering on a field called "Customer Name" then this would need to become "Customer%20Name" for the URL, as you cannot have spaces in URL parameters.

@adeekhan
Copy link
Author

Thanks Elliott, for the swift response allow me to reply both of your queries individually.
1 - Yes, your understanding is correct, I would like to download the raw data behind that view. similar to what we do in view when accessing it using web:
image
2- I have actually tried urllib.parse.quote() and confirm there is no such non URL friendly character. In the view on left hand I see many filters please see the screeenshot below, I had to remove text for security concerns however this can provide you the context. out of the filters I have noticed parameter_dict only the time Grain filter works fine however not the others.
image

@divinorum-webb
Copy link
Owner

For (1) you may need to download the datasource (Download Data Source endpoint) or download the workbook (Download Workbook endpoint) to get to your underlying data using Tableau. However, this is bad practice in my opinion. If you want the underlying data, going directly to the source and building ETL processes outside of Tableau is best. For example, if you connect to a database using Tableau and then want the underlying data, it's best to just pull that data from the database outside of Tableau, using whatever tool is best for the job. Using Tableau as a data extraction tool is perhaps doable, but it will be more painful and less scaleable than using a tool that's optimized for that task. Tableau is a great data exploration and dashboarding tool -- but performing ETL tasks using Tableau Desktop is not advised.

For (2) it is hard to say exactly what's wrong with these screenshots. It could be that you have aliased the filters in your dashboard, such that the names displayed do not reflect the actual underlying field. It could also be that the values within your fields are aliased (within Tableau) and that you need to reference the actual underlying values in your URL parameters. Whenever filters or parameters are not working for me in a REST API query, it's almost always either (a) an incorrect field name reference, or (b) an incorrect value on which to filter.

Hope that helps!

@adeekhan
Copy link
Author

Hi,
Thank you for the valuable input, the filters now actually works, it was indeed aliases which were causing the issue. For the first issue do you have a sample python code to download the datasource or workbook that I can modify to use in my code, please excuse my limited tableau and python knowledge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants