Skip to content

Getting on-server datasource ID from workbook connections #825

Description

@thesketh

Describe the bug
Not sure if this is a feature request or if I'm missing something obvious.

I'm trying to refresh all the datasources connected to a workbook. Our datasources are Athena connections (with extract enabled) which have been published to the server, and the workbook is connected to these on-server datasources. I want to use the API to get the datasource items from the workbook's connections. This can be done from the GUI in Tableau server - there are links in the "Data Sources" tab which take you from workbook page to datasource page.

Unfortunately, there doesn't seem to be any way to do this with TSC. I can get the workbook's connections, but these are sqlproxy connections, which don't seem to have any link to the actual datasource.

Versions
Details of your environment, including:

  • Tableau Server version: v2020.1
  • Python version: 3.7 or 3.8
  • TSC library version: 0.15.0

To Reproduce
Steps to reproduce the behavior. Please include a code snippet where possible.

# Create server, sign in...
# Get the workbook we're interested in.
wb = server.workbooks.get_by_id(workbook_id)
# This is the actual on-server datasource the workbook is connected to.
ds = server.datasources.get_by_id(datasource_id)
print(ds.datasource_type)  # 'athena'

# Populate the workbook's connections, get the connection.
server.workbooks.populate_connections(wb)
c = wb.connections[0]

# Get the datasource the connection points at.
ds2 = server.datasources.get_by_id(c.datasource_id)
print(ds2.datasource_type)  # 'sqlproxy'

# This is not the same as the datasource I want to refresh. Refreshing fails.
print(ds.id == ds2.id)  # False

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions