Skip to content

datasource_id from workbook connections does not match ids from datasources themselves #1194

@alexepperly

Description

@alexepperly

Describe the bug

After populating workbook connections, the datasource_ids in workbooks.connections.datasource_id don't appear to match with any of the ids from the datasources.id fields in our instance of Tableau Server.

It's totally possible I am being a dunce somehow or that there is some "duh" solution to this, but I can't find it. A few of us at work have tried to figure this out, but we think there might be something buggy going on.

Versions

  • Tableau Server version = 3.10
  • Python version = 3.9.13
  • TSC library version = 0.23.4

To Reproduce

After running these two functions (inside a class, hence all the selfs):

def populate_all_workbooks(self):
    
    self.all_workbooks = list(TSC.Pager(self.server.workbooks))
    
    # Populate all workbooks with connections
    for wb in self.all_workbooks:
        self.server.workbooks.populate_connections(wb)
        
# Create data frame with all values from workbook.connections
def get_workbook_connection_df(self):
    list_of_dicts = []
    for wb in self.all_workbooks:
        for connection in wb.connections:
            list_of_dicts.append({
                "id": connection.id,
                "Type": connection.connection_type,
                "ServerAddress": connection.server_address,
                "UserName": connection.username,
                "WorkbookId": wb.id,
                "DataSourceId": connection.datasource_id
                })
    return pd.DataFrame(list_of_dicts) 

Results

...Then we take the datasources.id from our most used datasource on our server instance (whose id I got directly in the XML with Postman, but also shows up querying it various ways through TSC). However, the following query yields nothing, zilch, nada:

# Our class is called TM

all_workbooks = TM.populate_all_workbooks()
workbook_connection_df = TM.get_workbook_connection_df()

# This yields no results. We did this many different ways, but this is the most concise version of the query
workbook_connection_df.query("DataSourceId == 'f78d82c3-c11f-49ce-ad8c-41b6e7d0990f'")

To be sure, we have looked for tons and tons of datasources.id's (in many different ways), and NONE of them are showing up in the list of workbooks.connections.datasource_id's that we have.

In fact, we created a dataframe of datasources similar to how we created the workbook_connections_df above, to wit:

  def get_datasource_df(self):
        list_of_dicts = []
        for ds in self.all_datasources:
            list_of_dicts.append({
                "id": ds.id,
                "Name": ds.name,
                "Type": ds.datasource_type
                })
    
        return pd.DataFrame(list_of_dicts)

...and none of the thousands of id's generated above are present when compared to the datasource_id values from workbook.connections.

We have tried doing this a ton of different ways, editing our classes, scripts, putting the values into SQL and querying/joining tables that way, and nothing seems to work.

Final TL;DR Version

The workbooks.connections.datasource_id property doesn't seem to match datasources.id.

(Or I'm doing something wrong.)

Thanks in advance for all your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions