當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Tableau workbooks.populate_connections用法及代碼示例

Tableau Server Client (TSC)workbooks.populate_connections的用法。

用法

workbooks.populate_connections(workbook_item)

填充指定工作簿的數據源連接列表。

您必須先填充連接,然後才能迭代連接。

此方法檢索指定工作簿的數據源連接信息。 REST API 旨在僅返回您明確要求的信息。查詢所有工作簿時,不包括數據源連接信息。使用此方法檢索工作簿使用的任何數據源的連接信息。該方法將數據連接列表添加到工作簿項 (workbook_item.connections)。這是 ConnectionItem 的列表。

REST API:Query Workbook Connections

參數

名字 說明
workbook_item workbook_item 指定要使用數據連接信息填充的工作簿。

異常

錯誤 說明
Workbook item missing ID. Workbook must be retrieved from server first. 如果未指定 workbook_item,則會引發錯誤。

返回

沒有任何。 ConnectionItem 對象列表添加到數據源 (workbook_item.connections)。

示例

# import tableauserverclient as TSC

# server = TSC.Server('https://SERVERURL')
#
   ...

# get the workbook item
  workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')


# get the connection information
  server.workbooks.populate_connections(workbook)

# print information about the data connections for the workbook item
  print("\nThe connections for {0}: ".format(workbook.name))
  print([connection.id for connection in workbook.connections])


  ...



相關用法


注:本文由純淨天空篩選整理自tableau.github.io大神的英文原創作品 workbooks.populate_connections。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。