Skip to content

Filter Operator.In - Cannot find groups/projects with spaces in their name #846

Closed

Description

@jesusenlanet

Description
Calling groups.get endpoint I'm unable to filter using the Operator.In operator.

Versions

  • Tableau Server version: 2021.1.0 (20211.21.0430.0040) 64-bit Linux
  • Python version: Python 3.7.7
  • TSC library version: tableauserverclient==0.15.0

To Reproduce

req_options = RequestOptions()
req_options.filter.add(Filter(RequestOptions.Field.Name, RequestOptions.Operator.In, ["Group A", "Group B"]))
groups, pagination = server.groups.get(req_options=req_options)
for group in groups:
    logger.info(group)

Results

<tableauserverclient.models.group_item.GroupItem object at 0x42>

Expected Results

<tableauserverclient.models.group_item.GroupItem object at 0x42>
<tableauserverclient.models.group_item.GroupItem object at 0x43>

Activity

  1. ovinis commented on Jun 14, 2021

    @ovinis
    Contributor

    Thank you! We are tracking this internally. Will get back to you as soon as we have an update.

    ID: 1278983

  2. jorwoods commented on Aug 31, 2021

    @jorwoods
    Contributor

    @jesusenlanet In your example, you use RequestOptions.Operator.Equals did you mean to use RequestOptions.Operator.In? Using In with groups works as expected for me.

  3. jesusenlanet commented on Sep 1, 2021

    @jesusenlanet
    Author

    Hey @jorwoods

    Oh, sorry for the Equals, I mean In, I think I make some error writing the comment, here the script I'm using:

    req_options = TSC.RequestOptions()
    req_options.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name, TSC.RequestOptions.Operator.In, ["Group A", "Group B"]))
    groups, pagination_item = server.groups.get(req_options)
    for group in groups:
        print(group.__dict__)

    What I'm obtaining is confusing, it looks that if a group is using a View template on the privileges, it doesn't appear on the list.
    Captura de pantalla 2021-09-01 a las 11 10 27

    Groups like that are not appearing on the results.

  4. jorwoods commented on Sep 1, 2021

    @jorwoods
    Contributor

    Do these groups also appear in the groups section of the site? Are you a site/server admin?

  5. jesusenlanet commented on Sep 1, 2021

    @jesusenlanet
    Author

    Do these groups also appear in the groups section of the site? Are you a site/server admin?

    Yes, I am an admin and those groups appear on the project permission list.

    I tried to retrieve groups for another projects and I'm unable to obtain some of the groups using the Publish template. I can't identify a pattern at this moment.

  6. jorwoods commented on Sep 1, 2021

    @jorwoods
    Contributor

    Not within the permissions list, but within the actual "Groups" section of the overall site.

  7. jesusenlanet commented on Sep 1, 2021

    @jesusenlanet
    Author

    Not within the permissions list, but within the actual "Groups" section of the overall site.

    Yes, they appear in the main groups list, some of them appear on the response, some other no.
    Also all of them have the same local domain.

  8. added
    help wantedA user needs help, may be a mistake, a bug or a feature request
    needs investigationIssue needs to be looked at by Tableau
    on Nov 8, 2021
  9. jacalata commented on Feb 16, 2023

    @jacalata
    Contributor

    In theory this was fixed a long while ago, but it's not working now. Same problem with searching In for projects. I suspect fixes we made for other encoding issues broke this one again.

  10. changed the title [-]Groups filter - Operator.In - Unable to make it work as expected[/-] [+]Filter Operator.In - Cannot find groups/projects with spaces in their name[/+] on Feb 16, 2023
  11. added and removed
    help wantedA user needs help, may be a mistake, a bug or a feature request
    needs investigationIssue needs to be looked at by Tableau
    on Feb 16, 2023
  12. bryceglarsen commented on Mar 25, 2023

    @bryceglarsen

    I think the same issue affects workbooks. Working on a sample with Superstore and World Indicators and not returning anything with In. 😢

  13. bab014 commented on Apr 24, 2023

    @bab014

    I have the exact same issue when querying for data sources. I have one that has a space in the name and it just removes the space and does not url encode it at all. So I don't get a match.

    The example datasource is "EoA Datasource - Pol"
    and when I debug the urllib3 output for the rest call is the following

    https://server/api/3.15/sites/site_id/datasources?pageNumber=1&pageSize=50$filter=name%3Ain%3A%5BMD1700%2CEoADatasource-Pol%5D
  14. LarsBreddemann commented on Jul 10, 2023

    @LarsBreddemann
    Contributor

    I face the same issue: when searching for projects, spaces in the search term are removed by this line 14
    in tableauserverclient/server/filter.py

       def __str__(self):
            value_string = str(self._value)
            if isinstance(self._value, list):
                value_string = value_string.replace(" ", "").replace("'", "")         <---
            return "{0}:{1}:{2}".format(self.field, self.operator, value_string)

    This really should be parsed into URL encoding instead of just removing spaces and single quotes
    urllib.parse.quote (value_string) should do the trick here.
    Or, simpler, value_string.replace (" ", "%20").replace("'", "")

    The last change to this line did not change this behavior.

    I do not see how enabling search terms with spaces requires a server side enhancement. When searching from the UI both Tableau Server and Cloud encode the space in the search term with %20 and return the correct result.

  15. LarsBreddemann commented on Jul 25, 2023

    @LarsBreddemann
    Contributor

    I've committed PR #1259 to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions