BI

How to refresh tableau extract via python API ?

In this blog , I am going share with you how to refresh extact using API calls.

  1. Install tableau python api packages
  2. also via pip: ” pip install tableauserverclient “
  3. use the this example python
  4. you are going to need: user, password, tableau sever ip address and workbook id.
  5. the workbook id is Luid (Workbooks) – this was the harded this to get. the idea was to connect to the postgress DB of tableau after the command runs enable a read only user and get the ID’s. Credit goes to Tomer Ben Tovim

The python package install :

pip install tableauserverclient

the tableau api call full example is committed in out git

from tableausdk import *
from tableausdk.HyperExtract import *
import tableauserverclient as TSC
user='omid'
password='123'
tableau_auth = TSC.TableauAuth(user, password)
server = TSC.Server('http://10.1.0.1')
server.version = '3.6'
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='37A13D3E-64D9-4F9B-ACD5-2FCB0291BF24')
server.auth.sign_out()
print('connection closed')
© 2020 GitHub, Inc.)

Resources:

https://help.tableau.com/current/pro/desktop/en-us/examples_postgresql.htm
enable repository
https://help.tableau.com/current/server/en-us/perf_collect_server_repo.htm
command :tsm data-access repository-access enable –repository-username readonly –repository-password

https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm

https://community.tableau.com/thread/287767

https://help.tableau.com/current/api/extract_api/en-us/Extract/extract_api_installing.htm

https://help.tableau.com/current/api/extract_api/en-us/Extract/extract_api_using_python.htm

Some other useful tableau related blogs:

How to install tableau on GCP

Tableau Demystified | Quick introduction in 10 minutes

——————————————————————————————————————————

I put a lot of thoughts into these blogs, so I could share the information in a clear and useful way. If you have any comments, thoughts, questions, or you need someone to consult with, feel free to contact me:

https://www.linkedin.com/in/omid-vahdaty/

Leave a Reply