We have 100+ datasources in our onprem tableau server, We need the list of datasources connected in this server, Kindly help to get that list by exporting over GUI or Linux command line.
#Tableau Server
Hi, you may use tableau server client:
https://tableau.github.io/server-client-python/docs/You may use a PAT:
https://help.tableau.com/current/pro/desktop/en-us/useracct.htm#create-a-personal-access-tokenThe code look like this:
import tableauserverclient as TSC
import csv
# Creds
HOST = "https://10ax.online.tableau.com/"
#Your PAT Name
TOKEN_NAME = "Python"
#Your PAT Value
TOKEN_VALUE = "tm5==hRdo"
# Use "" for default site
CONTENT_URL = "yoursiteuri"
tableau_auth = TSC.PersonalAccessTokenAuth(TOKEN_NAME, TOKEN_VALUE, site_id=CONTENT_URL)
server = TSC.Server(HOST, use_server_version=True)
fds = open('datasources.csv', 'w', encoding='UTF8', newline='')
dswriter = csv.writer(fds, delimiter=";")
dsheader = ['Name','Project','content_url','owner_id','ds_host','ds_port','ds_connection']
dswriter.writerow(dsheader)
with server.auth.sign_in(tableau_auth):
all_ds = server.datasources.all()
for ds in all_ds:
ds_item = server.datasources.populate_connections(ds)
for conn in ds.connections:
row = [ds.name,ds.project_name,ds.webpage_url,ds.owner_id,conn.server_address,conn.server_port,conn.connection_type]
dswriter.writerow(row)
fds.close()
server.auth.sign_out()
If this post resolves the question, would you be so kind to "Accept this Answer"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.
Regards,
Diego Martinez
Tableau Visionary and Tableau Ambassador