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
Unable to fetch all workbooks for users.populate_workbooks(user) #930
To Reproduce
`
import tableauserverclient as tsc
from tableauserverclient.server.endpoint.exceptions import ServerResponseError
def get_workbooks_users(self) -> list: #tableau credentials are passed through Self
list_workbooks_n_users = []
try:
with self.server.auth.sign_in(self.tableau_auth):
for user in tsc.Pager(self.server.users):
if 'tol.admin.api.broker.service.usera@tableau.com' not in user.name:
self.server.users.populate_workbooks(user)
for wkb in user.workbooks:
print(wkb.name, user.name)
list_workbooks_n_users.append({
'user_id': user.id,
'user_name': user.name,
'wb_id': wkb.id,
'wb_name': wkb.name,
'project_id': wkb.project_id,
'project_name': wkb.project_name,
"site_id": self.site_id
})
except ValueError:
print("some thing")
finally:
print("some other thing")
return list_workbooks_n_users
`
Results
I only get the first one hundred results for my user. I know the user has access to all tableau assets.
NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.
Hi @bcantoni, Thank you for your reply. It does work, but I have to supply a number of workbooks to pagesize that is equal to the number workbooks published online. Supplying 1000 doesn't work in my case. The users endpoint handled this well up until the second week of September.
Okay let me see if I understand correctly: if you have a user who has 156 workbooks, making the call with pagesize=156 does work, but setting it to a larger number like 200 or 1000 does not?
I'm having the same issue. I'm getting a "project_id must be defined" error if I page through too many results. I'm only able to get around 140 if I play around with the page size and page number.
I'm using the Pager generator for my function to retrieve all workbooks on the server.
@kdutta-c are you also getting an error for your calls, or just not seeing all the workbooks you expect? @adrianrlaus - are you using Collections or Personal Spaces? Is it possible that this error is returned when you first iterate over a workbook that is in a collection or personal space?
@jacalata, I don't see an error message when I put in the exact number of tableau workbooks into the parameters. Otherwise, I get an error ValueError: project_id must be defined.
However, I don't think project_id was an input value before September 2021. It worked perfectly fine without it. 🤷
I am trying to list all workbook names per user to know what users have access to what workbooks.
I am trying to do this:
def get_workbooks_users(self) -> list: #tableau credentials are passed through Self
list_workbooks_n_users = []
try:
with self.server.auth.sign_in(self.tableau_auth):
for user in tsc.Pager(self.server.users):
if 'tol.admin.api.broker.service.usera@tableau.com' not in user.name:
self.server.users.populate_workbooks(user)
for wkb in user.workbooks:
print(wkb.name, user.name)
list_workbooks_n_users.append({
'user_id': user.id,
'user_name': user.name,
'wb_id': wkb.id,
'wb_name': wkb.name,
'project_id': wkb.project_id,
'project_name': wkb.project_name,
"site_id": self.site_id
})
except ValueError:
print("some thing")
finally:
print("some other thing")
return list_workbooks_n_users
@kdutta-c FYI, populating workbooks on a user will tell you all workbooks that that user owns, not all workbooks that they have access to. For owners, you can also use the metadata API, with a query like this:
Getting all content that a user has access to is a much more complicated affair, requiring checking the permissions of every item on the server. the group membership of each user, and so on.... OR taking the equally complicated route of signing in to the site as each user and trying to query all workbooks on the server.
@kdutta-c FYI, populating workbooks on a user will tell you all workbooks that that user owns, not all workbooks that they have access to. For owners, you can also use the metadata API, with a query like this:
Getting all content that a user has access to is a much more complicated affair, requiring checking the permissions of every item on the server. the group membership of each user, and so on.... OR taking the equally complicated route of signing in to the site as each user and trying to query all workbooks on the server.
Thank you @jorwoods. Sounds interesting. I will try checking permissions based on the asset and not the user. I think, It should translate into the same output I need.
Activity
bcantoni commentedon Oct 27, 2021
@kdutta-c I think what's happening here is the underlying REST API call (query workbooks for user) is by default just returning 100 results.
I think you can request more by defining a request option object:
And then using that in your populate_workbooks call:
Let me know if that works. If so I'll repurpose this issue into a "make the request options more clear" doc bug so we can improve.
kdutta-c commentedon Oct 28, 2021
Hi @bcantoni, Thank you for your reply. It does work, but I have to supply a number of workbooks to pagesize that is equal to the number workbooks published online. Supplying 1000 doesn't work in my case. The users endpoint handled this well up until the second week of September.
bcantoni commentedon Oct 28, 2021
Okay let me see if I understand correctly: if you have a user who has 156 workbooks, making the call with pagesize=156 does work, but setting it to a larger number like 200 or 1000 does not?
kdutta-c commentedon Oct 28, 2021
You are right. It doesn't work with
RequestOptionsif I used a pagesize more than 156.bcantoni commentedon Oct 29, 2021
Okay thanks for the confirmation. The fact that it used to work and then stopped working (presumably with a Tableau Online update) is a good clue.
adrianrlaus commentedon Nov 2, 2021
I'm having the same issue. I'm getting a "project_id must be defined" error if I page through too many results. I'm only able to get around 140 if I play around with the page size and page number.
I'm using the Pager generator for my function to retrieve all workbooks on the server.
jacalata commentedon Nov 7, 2021
@kdutta-c are you also getting an error for your calls, or just not seeing all the workbooks you expect?
@adrianrlaus - are you using Collections or Personal Spaces? Is it possible that this error is returned when you first iterate over a workbook that is in a collection or personal space?
kdutta-c commentedon Nov 8, 2021
@jacalata, I don't see an error message when I put in the exact number of tableau workbooks into the parameters. Otherwise, I get an error
ValueError: project_id must be defined.However, I don't think project_id was an input value before September 2021. It worked perfectly fine without it. 🤷
adrianrlaus commentedon Nov 9, 2021
@jacalata I'm not using Collections or Personal Spaces
adrianrlaus commentedon Nov 22, 2021
Any update on this?
kdutta-c commentedon Dec 21, 2021
Hi, Any updates / hints on how to overcome this issue?
adrianrlaus commentedon Dec 21, 2021
Hi everyone! Updating to the latest version solved it for me
kdutta-c commentedon Dec 22, 2021
Are you sure?
I see that
class Workbookstill needsproject_idto run.Reference:
server-client-python/tableauserverclient/models/workbook_item.py
Line 16 in b3ca20e
I am trying to list all workbook names per user to know what users have access to what workbooks.
I am trying to do this:
hanishche commentedon Jan 19, 2022
HI any update on this
jorwoods commentedon Jan 22, 2022
@kdutta-c FYI, populating workbooks on a user will tell you all workbooks that that user owns, not all workbooks that they have access to. For owners, you can also use the metadata API, with a query like this:
Getting all content that a user has access to is a much more complicated affair, requiring checking the permissions of every item on the server. the group membership of each user, and so on.... OR taking the equally complicated route of signing in to the site as each user and trying to query all workbooks on the server.
kdutta-c commentedon Jan 24, 2022
Thank you @jorwoods. Sounds interesting. I will try checking permissions based on the asset and not the user. I think, It should translate into the same output I need.
jacalata commentedon Feb 16, 2023
This should have been fixed in the linked update to tsc in mid-2022.