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

Filter parameters in live connection are ignored during PDF or CSV generation #1438

Open
mohit-rana85 opened this issue Aug 13, 2024 · 6 comments
Labels
help wanted A user needs help, may be a mistake, a bug or a feature request needs investigation Issue needs to be looked at by Tableau

Comments

@mohit-rana85
Copy link

mohit-rana85 commented Aug 13, 2024

Describe the bug
Our workbooks contain data sources in extract mode for performance optimization. However, some data sources that are required for annotating the data need to remain in live connection mode to enhance the user experience. When we generate a pdf or csv from a view using the TSC package, all parameters in the extract are considered by the code, but the filters specific to selecting data in the live connection are ignored.

Versions
Details of your environment, including:

  • REST API version: 3.21
  • Python version: 3.9
  • TSC library version: 0.31

To Reproduce
Steps to reproduce the behavior. Please include a code snippet where possible.
We have a workbook with Impala connection (Extract) and oracle connection (Live connection).

Python code:

import tableauserverclient as TSC

SERVER_URL = 'your_server_url'
TOKEN_NAME = 'your_token_name'
TOKEN_VALUE = 'your_token_value'
SITE_NAME = 'your_site_name'
VIEW_NAME = 'your_view_name'
WORKBOOK_ID= 'your_workbook_id'

# initiate server connection 
server = TSC.Server(SERVER_URL, use_server_version=True)

# Use Personal Access Token for authentication
tableau_auth = TSC.PersonalAccessTokenAuth(token_name=TOKEN_NAME, personal_access_token=TOKEN_VALUE,
                                                site_id=SITE_NAME)
server.add_http_options({'verify': False})
server.version = '3.21'
server.auth.sign_in(tableau_auth)

# get workbook object 
workbook = server.workbooks.get_by_id(WORKBOOK_ID)

# populate view and specify filter parameters on the worksheet
server.workbooks.populate_views(workbook)
# Find the specific view by name
 view = next((v for v in workbook.views if v.name == VIEW_NAME), None)
req = TSC.PDFRequestOptions(maxage=-1, page_type='unspecified', orientation='landscape', viz_width=1200,
                                     viz_height=1000)
req.vf('country', 'Germany')  # parameter in extract
req.vf('company', 'abc')  # parameter in extract
req.vf('selected', 1)   # parameter in live connection

# populate pdf file
server.views.populate_pdf(view, req_options=req)

# write pdf file
output_file = "test.pdf"
 with open(output_file, 'wb') as file:
         file.write(view.pdf)

Results
What are the results or error messages received?
The PDF generated with the above code produces a report that ignores the "selected" parameter. The expected behavior is that the PDF should be generated considering all specified parameters, including those associated with the live connection.

NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.

@jorwoods
Copy link
Contributor

.vf is for filters in the view, e.g. quick filters. Set parameters via .parameter.

@mohit-rana85
Copy link
Author

Hi @jorwoods,
Thanks for the hint. I tried using the .parameter method, but it didn't change the result.

@mohit-rana85
Copy link
Author

Hi @jorwoods,
I tested the parameter method by providing some arbitrary value for the filter that should have resulted in empty PDF values, as it does with other filters on parameters present in the extract. However, the result remained exactly the same. Somehow, the filter for the parameter present in the live connection is completely ignored.

@bcantoni
Copy link
Contributor

I'm working on reproducing this. Will update here as I learn more.

As a workaround, people experiencing this might try using the REST API directly. TSC is just a thing wrapper on the REST APIs, so testing with them directly could help determine whether this is a backend or TSC side issue.

@bcantoni
Copy link
Contributor

I tried various workbooks/views on Tableau Server & Cloud and can't reproduce this yet. I tried on both live datasources and extracts.

I did notice using .parameter didn't seem to work, but .vf did (for both filters & parameters). We'll need to look more closely into that.

@mohit-rana85 can you share more details about your environment, including:

  • Are you on Tableau Cloud (which pod?), or Tableau Server (which version?)
  • In your example of parameter selected on your live extract, what type of value is used there? (float, int, boolean, etc)

@jacalata jacalata added help wanted A user needs help, may be a mistake, a bug or a feature request needs investigation Issue needs to be looked at by Tableau labels Sep 20, 2024
@mohit-rana85
Copy link
Author

Hi @bcantoni,

Thank you for your efforts.

I have tested the REST API directly using the parameter method along with the VF method, both with and without including the data source name in the query. Additionally, I attempted to add all filter values to the VF method. However, I was unable to generate the correct reports. Please find the code for your review test_rest_api_pdf_generation.txt.

To further investigate, I performed another test to determine if the live connection is causing the problem. I created two views: one containing parameters from an extract and another with parameters only from a live connection. The filter works as expected on both sheets.

Additionally, I conducted a test where both connections were live, and I interchanged the primary and secondary data sources in the relationship blend. In both cases, the data source included as a secondary data source in the relationship blend was completely ignored.

Based on these tests, my hypothesis is that the issue arises from the relationship blend, where the data source in the secondary status is ignored by the REST API and Tableau Server Client code.

Environment used for testing:
Tableau Server version: 2023.3.6
Rest API version: 3.21
Tableau Server Client: 0.31.0
Python: 3.9
Format of the Parameter that I am trying to filter: Integer

Please let me know if any additional information is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted A user needs help, may be a mistake, a bug or a feature request needs investigation Issue needs to be looked at by Tableau
Projects
None yet
Development

No branches or pull requests

4 participants