tableau / server-client-python

A Python library for the Tableau Server REST API
https://tableau.github.io/server-client-python/
MIT License
655 stars 420 forks source link

[DatasourceItem] use_remote_query_agent settable on publish #1401

Closed MSGMax closed 3 months ago

MSGMax commented 3 months ago

Summary

Can we have DatasourceItem attribute use_remote_query_agent settable (True/False), so we can publish Datasources that are capable of connecting to Private Networks (use Tableau Bridge)?

Request Type

Currently this attribute cannot be set when DatasourceItem object is created.

Type 1: support a REST API: This functionality is supported by REST API https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#update_data_source

Type 2: add a REST API and support it in tsc. N/A

Type 3: new functionality N/A

Description

Enable setting use_remote_query_agent (True/False) when DatasourceItem item is being created

jorwoods commented 3 months ago

It looks like use_remote_query_agent is already an attribute on DatasourceItems, and included as part of the XML request during publish, though not included as part of update requests. Does this existing functionality meet your need?

https://github.com/tableau/server-client-python/blob/777db4ef914c00d955ec215d869f8c0f845d58d7/tableauserverclient/server/request_factory.py#L163-L164

MSGMax commented 3 months ago

Hi jorwoods,

Thanks for looking into it. I have a problem with initialising DatasourceItem before I can even publish it as per below code: datasource_item = tsc.DatasourceItem(project_id='hh881338-4a4c-4365-837t-abc7aa1c69e6', name='test', use_remote_query_agent=True)

above throws the following error: DatasourceItem.init() got an unexpected keyword argument 'use_remote_query_agent'.

Can you give me an example of a code that would allow me to publish a new data source with use_remote_query_agent set to true (default is false)?

Thanks, M

jorwoods commented 3 months ago
datasource_item = tsc.DatasourceItem(project_id='hh881338-4a4c-4365-837t-abc7aa1c69e6',  name='test')
datasource_item.use_remote_query_agent=True
MSGMax commented 3 months ago

Works perfectly. Case closed. Thank you very much.