server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

Issue updating connections on workbooks to datasources

Open DaniilBalabanov33N opened this issue 5 years ago • 3 comments

Hi, I'm trying to update connections on workbooks. The example provided in samples works for datasources, but when I'm updating workbooks I'm getting the following error:

400039: Bad Request There was a problem updating connection {CONNECTION_ID} for workbook {WORKBOOK_ID}.

Maybe it's a different issue, but how would one update workbook connections to point to a different datasource on Tableau? From what I can see the connections get updated by simply overriding the attributes on the ConnectionItem class and then building an xml/text request. What I can't see is how to change datasource_name/datasource_id on the ConnectionItem class (it's private methods).

UPDATE: I've also noticed I can not publish new workbooks. Even if I just download a wb from the server, give it a different name (By setting WorkbookItem(project_id='123', name='new_name'), and try to upload it. The error I get is:

400011: Bad Request here was a problem publishing the file {FILE_PATH}

UPDATE: I've managed to fix uploading issue.

I also checked the Tableau logs on updating connections on workbooks and it's throwing a java error saying: dbclass: sqlproxy is not editable (errorCode=60004) So my question stays the same: how would one point a workbook to use a different datasource

DaniilBalabanov33N avatar Sep 30 '20 10:09 DaniilBalabanov33N

Basically I'm trying to replicate this `for wb in wb_files:

    t_file = TableauFileManager.open(filename=wb_files[wb], logger_obj=logger)
    dses = t_file.datasources
    for ds in dses:
        if ds.is_published is True:
            # Set the Site of the published data source
            ds.published_ds_site = d_site_connection.site_content_url
            o_ds_content_url = ds.published_ds_content_url
            if o_ds_content_url in orig_ds_content_url:
                ds.published_ds_content_url = orig_ds_content_url[o_ds_content_url].new_content_url
        # If the datasources AREN'T published, then you may need to change details directly here
    temp_wb_file = t_file.save_new_file('Modified Workbook'.format(wb))
    new_workbook_luid = d.workbooks.publish_workbook(workbook_filename=temp_wb_file, workbook_name=wb,
                                           project_obj=dest_project,
                                           overwrite=True)
    print('Published new workbook {}'.format(new_workbook_luid))
    os.remove(temp_wb_file)`

DaniilBalabanov33N avatar Oct 01 '20 13:10 DaniilBalabanov33N

I also faced the 400039 issue, anybody have found a way to work around it? ServerResponseError:

400039: Bad Request
	There was a problem updating connection '' for workbook ''.

davidhacrypto avatar Jul 19 '22 07:07 davidhacrypto

@davidhacrypto and @DaniilBalabanov33N were you able to find a resolution to the below issue? I am experiencing the same error. I am trying to update connection email and password for the data source in a tableau workbook on Tableau Cloud using the tableauserverclient package on python and I get the same error as both of you:

400039: Bad Request There was a problem updating connection '<connection id>' for workbook '<workbook id>'.

TeyTetterfio avatar Aug 07 '23 18:08 TeyTetterfio