pythonpython-3.xtableau-api

Tableau dashboard refresh using Python


Is there a way to refresh Tableau dashboards using Python? I need to refresh Tableau dashboards after my data is loaded into DB.


Solution

  • The Tableau REST API will allow you to refresh your extracts via Python.

    Here is an example of a script which should get you started:

    import tableauserverclient as TSC
    
    tableau_auth = TSC.TableauAuth(user, password)
    server = TSC.Server('Address')
    server.version = '2.3'
    resource_id= 6109
    with server.auth.sign_in(tableau_auth):
    print('connection made')
    print(server.version)
    #resource = server.workbooks.get_by_id(resource_id)
    server.workbooks.refresh(workbook_id='6109')
    
    server.auth.sign_out()
    print('connection closed')