Skip to main content

Hello!

 

I have this question about Tableau Server Client (Python) library. We are trying to query datasources with Viewer license user who has access to data source and the workbook. However I'm getting error "user isn't authorized to query datasource 'datasource_id'"

 

It works if user has site admin (Creator) or Explorer license role. My question is if it's possible to query datasource with Viewer license?

 

I have also tried curl request with same user and license type. Using curl I was able to get info about datasource. I also don't have much knowledge about using rest api so it might be issue on my side.

3 answers
  1. Sep 6, 2024, 2:40 PM

    @Matthias Johann Kurs​ 

    Hi, I think it is possible. I have run this code and it worked:

    #import os

    from datetime import datetime, timezone

    import datetime as DT

    import tableauserverclient as TSC

     

    literal_date = DT.datetime(2000, 1, 1)

    SERVER = 'https://yourserver.com'

    #tableau_auth = TSC.PersonalAccessTokenAuth(PAT_NAME,PAT_VALUE,site_id=SITE_NAME)

    tableau_auth = TSC.TableauAuth('viewer', 'mypasswd', site_id='')

    server = TSC.Server(SERVER, use_server_version=True)

    with server.auth.sign_in(tableau_auth):

    print('Logged in')

    now = datetime.now(timezone.utc)

    print(now)

    datasources = [ds for ds in TSC.Pager(server.datasources) if (now-(ds.updated_at or literal_date)).days>=1 and ds.has_extracts]

    for ds in datasources:

    print((now-(ds.updated_at or now)).days, ds.name, ds.updated_at, ds.project_name)

    If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions.

     

    Does the user has the view and connect permission for the published data source?

     

    Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000