tableau / rest-api-samples

Samples for the Tableau REST API
MIT License
394 stars 273 forks source link

Can not activate 'queryTaggingEnabled' to true for a bigquery datasource #69

Open ivmonnier opened 2 years ago

ivmonnier commented 2 years ago

Hello,

I have a Tableau Server 2022.1.3 (API v 3.15). Using REST API, I have successfully activated the 'queryTaggingEnabled' property to true for a published datasource linked to a MS SQL Server.

I wanted to do the same for a published datasource linked to a big query dataset. The 'queryTaggingEnabled' property remains to false.

I am stuck, and my goal is to investigate on big query to limit costs.

Waiting for help

Thank you

Ivan

jacalata commented 2 years ago

Hi Ivan, if you are still looking for help, could you include the request and response for your attempt to update this attribute? How are you trying to do this? cheers, Jac

SandervandenOord commented 1 year ago

I have exactly the same problem:

I would like to set querytaggingenabled=true so that I can track all queries and costs on GCP that were made by Tableau. Specifically for workbooks that use BigQuery as a datasource.

Maybe it has to do with oAuth connections: how to set querytaggingenabled=true for oAuth connections such as BigQuery?

I basically use the following python code:

xml_request = ET.Element('tsRequest')
connection_element = ET.SubElement(xml_request, 'connection', queryTaggingEnabled="true")
xml_request = ET.tostring(xml_request)

response = requests.put(
  workbook_conn_url + "/" + "5a4e451a-1130",
  headers=tableau_authentication_headers,
  data=xml_request,
)

Which comes down to doing this PUT request:
PUT /api/api-version/sites/site-id/workbooks/workbook-id/connections/connection-id

But I get the following generic error: '{"error":{"summary":"Bad Request","detail":"There was a problem updating connection \'5a44-9130\' for workbook \'cc2007e72baa\'.","code":"400039"}}'

What should I do to fix this? The connection I'm trying to alter is a BigQuery connection. Is it impossible to update BigQuery connections?

How can I set querytaggingenabled=true for this connection?

See also:
https://stackoverflow.com/q/70278355/3489155

Further documentation:
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_how_to_query_tagging.htm https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_workbooks_and_views.htm#update_workbook_connection

SandervandenOord commented 1 year ago

I created a support case with Tableau for this:

My conclusion: -> Changing oauth connections (such as BQ) is not possible at the moment:

Case 08682091:   
Set querytaggingenabled value to true for data sources that that require oauth or   
MFA checks such as BigQuery 

Hi Sander,

As per developers notes, updating connections, whose data is stored in multiple places is complicated and  
consequently Oauth connections can't be edited. So this is a "by design" for security and consistency   
restriction reasons.

This issue is contained specifically to data sources that require an oauth / MFA checks, such as BigQuery.   
Logs report dbclass: bigquery is not editable (errorCode=60004).

Since the restriction is currently by design and there is no workaround for the issue at the moment, I will   
enter an enhancement request on your behalf for the Product Management team to review for possible   
inclusion in a future release. Another option to provide suggestions for product enhancements is to submit  
 an idea through our community: http://community.tableau.com/community/ideas Providing feedback   
through the community forums allows other users to vote and discuss enhancement requests, and allows   
our development team to gauge the demand for each enhancement. Your feedback is invaluable and  
 helps us improve our software.
alisymebv commented 1 year ago

Hey folks,

I'm trying the same for a BigQuery Data Source using Service Account connection. Has there been any update on this issue or maybe a workaround figured out?