8000 Groups.populate_users() doesn't return more than 100 records · Issue #141 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

Groups.populate_users() doesn't return more than 100 records #141

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

Closed
cmtoomey opened this issue Feb 12, 2017 · 3 comments
Closed

Groups.populate_users() doesn't return more than 100 records #141

cmtoomey opened this issue Feb 12, 2017 · 3 comments
Labels

Comments

@cmtoomey
Copy link
Contributor

I'm trying to get a list of usernames in a large group (117 people), but populate_users only returns 100 items. The function doesn't take an upper bound page size, so it sticks with 100

#Get list of Tableau_Publishers
group_list = server.groups.get()
group_num = range(len(group_list[0]))
#Find Tableau_Publisher Group ID
for i in group_num:
    if group_list[0][i].name == 'Tableau_Publishers':
        publisher_id = group_list[0][i]
        print server.groups.populate_users(publisher_id)
        print len(group_list[0][i].users)

Populate_users appears to obey the default REST API request pagination, but doesn't accept a setting to bump the page size, and there is no documentation on the Groups endpoint at all.

Default should either be higher than 100, or accept input on max size.

@t8y8
Copy link
Collaborator
t8y8 commented Feb 17, 2017

Hey Chris!

We've confirmed your CLA, thank you!

So, I floated a crazy idea by @benlower and it worked -- can we follow up offline? I think I have your email or can find it easily :)

(PS, there is a workaround for you today -- populate_groups does take a RequestOptions object, so you can pass it a page size of 1000 -- would that work for your use case?)

opts = TSC.RequestOptions(pageSize=1000)
server.groups.populate_users(group_item, opts)

@cmtoomey
Copy link
Contributor Author

Always interested in crazy ideas - drop me an email whenever. If you don't have my email handy, it's on the homepage of my blog.

@t8y8
Copy link
Collaborator
t8y8 commented Jul 5, 2017

Wooooo.

This should be fixed in development... check it out @cmtoomey and @ugamarkj!

Note, the code would now look like:

#Get list of Tableau_Publishers
group_list, _ = server.groups.get()

#Find Tableau_Publisher Group ID
for group in group_list:
    if group.name == 'Tableau_Publishers':
        server.groups.populate_users(group)
        print len(list(group.users))
        print "\n".join([u.name for u in group.users])

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

No branches or pull requests

2 participants
0