Skip to content

populate_workbook_default_permissions (and others) do multiple identical requests #1301

@gconklin

Description

@gconklin

Describe the bug
This is more of a performance issue than an outright bug.
Getting default permissions causes up to 3x duplicate round trips to the Tableau server.
Doing this across all projects for all permission types (workbooks, datasources, etc - 7 in total) adds a significant amount of time since each project would be doing 21 requests just to read the permissions.

Versions

  • Tableau Server version: "20221.22.1108.1355"
  • Python version: 3.9.17
  • TSC library version: 0.28'

To Reproduce

server.projects.populate_workbook_default_permissions(project) # this immediately does 2 identical requests to the server
permissions = project.default_workbook_permissions # this does a 3rd request

Results
Multiple redundant requests to read permissions.

(Pdb) server.projects.populate_workbook_default_permissions(project)   # INITIAL POPULATE COMMAND
<<<Request 1>>>
DEBUG:TSC:request method get, url: https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
DEBUG:TSC:[17:10:42] Begin blocking request to https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
DEBUG:urllib3.connectionpool:Resetting dropped connection: tableau.server.com
DEBUG:urllib3.connectionpool:https://tableau.server.com:443 "GET /api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks HTTP/1.1" 200 536
DEBUG:TSC:[17:10:43] Call finished
DEBUG:TSC:[17:10:43] Request complete
DEBUG:TSC:[17:10:43] Async request returned: received <Response [200]>
DEBUG:TSC:Response status: <Response [200]>
DEBUG:TSC:Server response from https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
INFO:TSC:{'content_type': 'workbook', 'permissions': [<PermissionsRule grantee=<ResourceReference id=0607f2a4-3bcb-11e4-9a86-ef56b67f7bce tag=group>, capabilities={'ViewComments': 'Allow', 'ShareView': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Write': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportData': 'Allow', 'Read': 'Allow', 'Filter': 'Allow', 'AddComment': 'Allow', 'ExportImage': 'Allow', 'RunExplainData': 'Allow'}>, <PermissionsRule grantee=<ResourceReference id=2628306c-341f-427e-b1bd-8da5755b2c45 tag=group>, capabilities={'Write': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Filter': 'Allow', 'ViewComments': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportImage': 'Allow', 'Read': 'Allow', 'RunExplainData': 'Allow', 'AddComment': 'Allow', 'ShareView': 'Allow', 'ExportData': 'Allow'}>]}
INFO:root:{'type': '_default_workbook_permissions', 'value': [<PermissionsRule grantee=<ResourceReference id=0607f2a4-3bcb-11e4-9a86-ef56b67f7bce tag=group>, capabilities={'ViewComments': 'Allow', 'ShareView': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Write': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportData': 'Allow', 'Read': 'Allow', 'Filter': 'Allow', 'AddComment': 'Allow', 'ExportImage': 'Allow', 'RunExplainData': 'Allow'}>, <PermissionsRule grantee=<ResourceReference id=2628306c-341f-427e-b1bd-8da5755b2c45 tag=group>, capabilities={'Write': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Filter': 'Allow', 'ViewComments': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportImage': 'Allow', 'Read': 'Allow', 'RunExplainData': 'Allow', 'AddComment': 'Allow', 'ShareView': 'Allow', 'ExportData': 'Allow'}>]}
<<<Request 2>>>
DEBUG:TSC:request method get, url: https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
DEBUG:TSC:[17:10:43] Begin blocking request to https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
DEBUG:urllib3.connectionpool:https://tableau.server.com:443 "GET /api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks HTTP/1.1" 200 536
DEBUG:TSC:[17:10:43] Call finished
DEBUG:TSC:[17:10:43] Request complete
DEBUG:TSC:[17:10:44] Async request returned: received <Response [200]>
DEBUG:TSC:Response status: <Response [200]>
DEBUG:TSC:Server response from https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
INFO:TSC:{'content_type': 'workbook', 'permissions': [<PermissionsRule grantee=<ResourceReference id=0607f2a4-3bcb-11e4-9a86-ef56b67f7bce tag=group>, capabilities={'ViewComments': 'Allow', 'ShareView': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Write': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportData': 'Allow', 'Read': 'Allow', 'Filter': 'Allow', 'AddComment': 'Allow', 'ExportImage': 'Allow', 'RunExplainData': 'Allow'}>, <PermissionsRule grantee=<ResourceReference id=2628306c-341f-427e-b1bd-8da5755b2c45 tag=group>, capabilities={'Write': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Filter': 'Allow', 'ViewComments': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportImage': 'Allow', 'Read': 'Allow', 'RunExplainData': 'Allow', 'AddComment': 'Allow', 'ShareView': 'Allow', 'ExportData': 'Allow'}>]}
INFO:TSC:Populated default workbook permissions for item (ID: 2fe9f43b-59f9-4ef8-bae3-29b07544c30c)

(Pdb) wb_permissions = project.default_workbook_permissions  # LOOK AT PERMISSIONS
<<<Request 3>>>
DEBUG:TSC:request method get, url: https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
DEBUG:TSC:[17:11:06] Begin blocking request to https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
DEBUG:urllib3.connectionpool:Resetting dropped connection: tableau.server.com
DEBUG:urllib3.connectionpool:https://tableau.server.com:443 "GET /api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks HTTP/1.1" 200 None
DEBUG:TSC:[17:11:07] Call finished
DEBUG:TSC:[17:11:07] Request complete
DEBUG:TSC:[17:11:07] Async request returned: received <Response [200]>
DEBUG:TSC:Response status: <Response [200]>
DEBUG:TSC:Server response from https://tableau.server.com/api/3.15/sites/196f7f59-a0fe-4e6f-a6df-0d50b181e500/projects/2fe9f43b-59f9-4ef8-bae3-29b07544c30c/default-permissions/workbooks
INFO:TSC:{'content_type': 'workbook', 'permissions': [<PermissionsRule grantee=<ResourceReference id=0607f2a4-3bcb-11e4-9a86-ef56b67f7bce tag=group>, capabilities={'ViewComments': 'Allow', 'ShareView': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Write': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportData': 'Allow', 'Read': 'Allow', 'Filter': 'Allow', 'AddComment': 'Allow', 'ExportImage': 'Allow', 'RunExplainData': 'Allow'}>, <PermissionsRule grantee=<ResourceReference id=2628306c-341f-427e-b1bd-8da5755b2c45 tag=group>, capabilities={'Write': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Filter': 'Allow', 'ViewComments': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportImage': 'Allow', 'Read': 'Allow', 'RunExplainData': 'Allow', 'AddComment': 'Allow', 'ShareView': 'Allow', 'ExportData': 'Allow'}>]}
[<PermissionsRule grantee=<ResourceReference id=0607f2a4-3bcb-11e4-9a86-ef56b67f7bce tag=group>, capabilities={'ViewComments': 'Allow', 'ShareView': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Write': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportData': 'Allow', 'Read': 'Allow', 'Filter': 'Allow', 'AddComment': 'Allow', 'ExportImage': 'Allow', 'RunExplainData': 'Allow'}>, <PermissionsRule grantee=<ResourceReference id=2628306c-341f-427e-b1bd-8da5755b2c45 tag=group>, capabilities={'Write': 'Allow', 'CreateRefreshMetrics': 'Allow', 'Filter': 'Allow', 'ViewComments': 'Allow', 'ViewUnderlyingData': 'Allow', 'ExportImage': 'Allow', 'Read': 'Allow', 'RunExplainData': 'Allow', 'AddComment': 'Allow', 'ShareView': 'Allow', 'ExportData': 'Allow'}>]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions