如何从每个站点获取项目列表,然后从每个项目获取工作簿列表?

2024-04-19 06:29:19 发布

您现在位置:Python中文网/ 问答频道 /正文

首先我想要一个站点列表,然后我想要每个站点中的项目列表,然后我想要每个项目中的工作簿列表

即站点>&燃气轮机;项目>&燃气轮机;工作手册

我正在使用Tableauserverclient。请帮助我,提前谢谢


Tags: 项目gt列表站点燃气轮机tableauserverclient工作手册
1条回答
网友
1楼 · 发布于 2024-04-19 06:29:19

查看Tableau的github页面。它有所有的例子

我会考虑使用TabLay^ workgroup数据库,除非您需要Python进行其他操作。

网站

import tableauserverclient as TSC  
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD')  
server = TSC.Server('https://SERVER')  

# query the sites
all_sites, pagination_item = server.sites.get()

# print all the site names and ids
for site in all_sites:
   print(site.id, site.name, site.content_url, site.state)

项目

import tableauserverclient as TSC  
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD', site_id='CONTENTURL')  
server = TSC.Server('https://SERVER')  

with server.auth.sign_in(tableau_auth): 
    # get all projects on site
    all_project_items, pagination_item = server.projects.get()
    print([proj.name for proj in all_project_items])

工作手册

import tableauserverclient as TSC
tableau_auth = TSC.TableauAuth('username', 'password', site_id='site')
server = TSC.Server('https://servername')

with server.auth.sign_in(tableau_auth):
    all_workbooks_items, pagination_item = server.workbooks.get()
    # print names of first 100 workbooks
    print([workbook.name for workbook in all_workbooks_items])

相关问题 更多 >