server-client-python: 400011: Bad Request when publishing .hyper datasource

After reviewing issue #488 , I found that I am experiencing the issue on single table extracts as opposed to multi.

any help and suggestions would be appreciated. I have tried several variations in specifying file paths and publish modes but all fail with a bad request.

Thanks!

Here is my code

import tableauserverclient as TSC
import os

cwd = os.getcwd()
file = 'Groups.hyper'

tableau_auth = TSC.TableauAuth(username,password)
server = TSC.Server('http://'+server_name)
server.use_server_version()
server.add_http_options({'verify': False})

with server.auth.sign_in(tableau_auth):
    new_datasource = TSC.DatasourceItem(project_id, 'Groups Extract python')
    new_datasource = server.datasources.publish(new_datasource,
    os.path.join(cwd,file),
    'CreateNew')

Running with error

Traceback (most recent call last):
  File "tester.py", line 20, in <module>
    'CreateNew')
  File "C:\Users\amsmith1\Desktop\tableauUserMgmt\venv\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 127, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\amsmith1\Desktop\tableauUserMgmt\venv\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 165, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\amsmith1\Desktop\tableauUserMgmt\venv\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 165, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\amsmith1\Desktop\tableauUserMgmt\venv\lib\site-packages\tableauserverclient\server\endpoint\datasources_endpoint.py", line 204, in publish
    server_response = self.post_request(url, xml_request, content_type)
  File "C:\Users\amsmith1\Desktop\tableauUserMgmt\venv\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 102, in post_request
    content_type=content_type)
  File "C:\Users\amsmith1\Desktop\tableauUserMgmt\venv\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 55, in _make_request
    self._check_status(server_response)
  File "C:\Users\amsmith1\Desktop\tableauUserMgmt\venv\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 70, in _check_status
    raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace)
tableauserverclient.server.endpoint.exceptions.ServerResponseError:

        400011: Bad Request
                There was a problem publishing the file 'Groups.hyper'.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 2
  • Comments: 19 (1 by maintainers)

Most upvoted comments

In my situation, I would get an error such as: 400011: Bad Request There was a problem publishing the file '26353:e93e1c2aa6fd41169169a8de2a438ca4-1:0'. when publishing very large extracts.

This was fixed by utilizing the as_job=True option on server.datasources.publish()

EDIT: Found solution for my situation. I was using option 2 in this link https://help.tableau.com/current/api/hyper_api/en-us/docs/hyper_api_publish.html#publish-single-table-hyper-files

The key was to create a table object called “Extract” in schema “Extract” for hyper file publish to work. Not sure if same as others but when I did that with python code ala below it worked

my_table = TableName(“Extract”, “Extract”)

Then pass my_table into the frame_to_hyper call…

original message: I am also having same issue

tableauserverclient==0.11 python==3.6.5 tableau server==2019.2.3 (20192.19.0818.2120)

I have tried using different REST api versions to no avail. Also, I can publish a workbook successfully using all the same set up code, only my attempt to publish a datasource (hyper file) fails with 400011

If someone happens to be making any edits to an extract, I highly recommend defragmenting your extract prior to publishing - see Rewrite your Hyper file in an optimized format. As I recall, I had issues in the past with Tableau Server running out of memory on very large extracts after being edited and it would throw this error. After defragmenting in my unique case, it would publish correctly.