You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
workbook filter fails with special characters. #1200
Unfortunately you can't represent some characters in a search, but you can replace them with a wildcard.
Specifically, I think it's "," and "&" that don't work. But this does:
` wb_name = "T(L-FSZV-MY) - PC"
print("Searching for " + wb_name + "")
for workbook in server.workbooks.filter(name=wb_name):
print(workbook.name, workbook.id)
`
produces:
Searching for T(L-F*SZ*V-MY) - PC
T(L-F,SZ&V-MY) - PC b5d8b87f-3a3c-4787-83d4-6fd5cc2664db
T(L-F^SZ|V-MY) - PC 44ea14d9-54e8-4b9f-9ec9-150fbea57b08
So would it make sense to add a replace_illegal_chars argument, hopefuly something pithier, to filter? I could try it if I get a hint or something. There's not a lot of doc strings in this repo.
deffilter(self, *invalid, **kwargs):
ifinvalid:
raiseRuntimeError(f"Only accepts keyword arguments.")
# special arg to allow for filtering on fields that contain illegal charactersreplace_illegal_characters=kwargs.pop("replace_illegal_characters", False)
forkwarg_key, valueinkwargs.items():
field_name, operator=self._parse_shorthand_filter(kwarg_key)
ifreplace_illegal_characters:
value=self._replace_illegal_characters(value)
self.request_options.filter.add(Filter(field_name, operator, value))
returnselfdef_replace_illegal_characters(self, value):
"""helper function to replace illegal characters in a string value for filtering"""ifisinstance(value, str):
returnvalue.replace(",", "*").replace('&', '*')
returnvalue
Not sure if this applies here, but we've run into issues with commas in other queries. We got around them by replacing , with %5C%2C instead of just %2C. If I can figure out how to test a patch I may try it when I have some more time.
We have a bunch of questions around filters, and will go through all of them to carefully document current behavior. that might turn into some work items if there are inconsistencies/gaps.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this is still relevant, please comment to keep it open.
Activity
jacalata commentedon Mar 14, 2023
Unfortunately you can't represent some characters in a search, but you can replace them with a wildcard.
Specifically, I think it's "," and "&" that don't work. But this does:
` wb_name = "T(L-FSZV-MY) - PC"
`
produces:
Searching for
T(L-F*SZ*V-MY) - PCT(L-F,SZ&V-MY) - PC b5d8b87f-3a3c-4787-83d4-6fd5cc2664db
T(L-F^SZ|V-MY) - PC 44ea14d9-54e8-4b9f-9ec9-150fbea57b08
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_filtering_and_sorting.htm#filter-expression-notes
jacalata commentedon Apr 12, 2023
Should make sure our docs mention this limitation and workaround.
VDFaller commentedon Apr 20, 2023
So would it make sense to add a
replace_illegal_charsargument, hopefuly something pithier, to filter? I could try it if I get a hint or something. There's not a lot of doc strings in this repo.Maybe here?
something like
mtwalkup commentedon Nov 16, 2023
Not sure if this applies here, but we've run into issues with commas in other queries. We got around them by replacing , with %5C%2C instead of just %2C. If I can figure out how to test a patch I may try it when I have some more time.
mtwalkup commentedon Nov 17, 2023
Disregard my last comment, I tried to make it work and forced a \ (%5C) before the comma still got a 400 error.
However; just wanted to also note I am getting this same problem with a job filter.
Edit: comma instead of command
jacalata commentedon Sep 20, 2024
We have a bunch of questions around filters, and will go through all of them to carefully document current behavior. that might turn into some work items if there are inconsistencies/gaps.
github-actions commentedon Aug 6, 2026
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this is still relevant, please comment to keep it open.
docs: clarify username formats, ProjectLeader-as-group, and filter sp…