server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

Filtering Datasources using the "In" Operator

Open tuse0708 opened this issue 4 years ago • 3 comments

When attempting to filter using the "In" operator on datasources, I am able to filter a single source using "Equals" but if I switch to "In" and supply a list, I get "400065: Bad Request. The filter query is missing a value for key 'name'."

Versions

Tableau Server Version: 2019.4.2 (20194.20.0119.2058) 64-bit Linux Python 3.8.4 TSC library version - 0.15

To Reproduce

import tableauserverclient as TSC

username = ""
pw = ""
site = ""
tableau_auth = TSC.TableauAuth(username, pw, site)
server = TSC.Server('https://HOSTNAME/', use_server_version=True)
req_option = TSC.RequestOptions()

jobs_to_refresh = ['Example Job 1','Example Job 2']

with server.auth.sign_in(tableau_auth):
    req_option.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name,
                                TSC.RequestOptions.Operator.In,
                                jobs_to_refresh))
    matching_datasources, pagination_item = server.datasources.get(req_options=req_option)
    print(matching_datasources[0].name, matching_datasources[0].id)

Results 400065: Bad Request. The filter query is missing a value for key 'name'.

tuse0708 avatar Mar 25 '21 15:03 tuse0708

@tuse0708 are you still facing this issue?

I've not been able to reproduce the problem so far. Can you show what are your actual names you're providing in jobs_to_refresh? I can see some past issues when those names have ampersands or dashes in them.

bcantoni avatar Apr 23 '21 22:04 bcantoni

@bcantoni I am still facing the issue. The code reads as follows......

jobs_to_refresh = ['Stroke and AMI NPOA Extract','Readmission Dashboard Extract']

tuse0708 avatar Apr 26 '21 18:04 tuse0708

I'll double-check this to make sure our docs/example show it correctly.

bcantoni avatar Sep 19 '24 21:09 bcantoni