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

400011: Bad Request when publishing .hyper datasource

Open drewsmith9 opened this issue 5 years ago • 19 comments

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'.

drewsmith9 avatar Mar 17 '20 15:03 drewsmith9

tableauserverclient==0.9 python==3.7.4 tableau server==2019.4.4

drewsmith9 avatar Mar 18 '20 16:03 drewsmith9

I'm not exactly quite sure about this as well and I have the exact same issue. I think I read somewhere to handle this exception by changing the server.version to a number that is compatible with your server?

Any help from the community would be appreciated it

williamxnguyen avatar Mar 25 '20 23:03 williamxnguyen

I am also trying to pass use_server_version = True into TSC.Server() with no success.

Is this what you were referencing or a hard-coded sever version? @williamxnguyen

drewsmith9 avatar Mar 26 '20 13:03 drewsmith9

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

jla2w avatar Jun 03 '20 17:06 jla2w

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()

Rchender avatar Sep 01 '20 21:09 Rchender

May i please know if there is any workaround ? I am facing the same issue .

vishalgogineni avatar Oct 29 '20 06:10 vishalgogineni

Feel free to reopen the issue if you think that the issue is not solved

illonage avatar Jan 04 '22 16:01 illonage

I would double check to make sure the hyper file is good, I was converting from a CSV to a hyper using this example and was also getting the 400011 error until I added the as_job=True value. I imagine it is because hyper files are bulky (it turned my 50 Byte csv file into a 66 KB hyper file), and according to the Tableau REST API docs, this setting changes the publishing from synchronous to asynchronous.

mcdowellalex avatar Jul 14 '22 14:07 mcdowellalex

Perhaps if that is the case, and if Tableau want to really push hyper as a go to data source format, then this flag should be default as True?

And perhaps I spoke too soon. I wasn't receiving any response errors from Tableau, but the data source still is not being published for me.

mcdowellalex avatar Jul 14 '22 14:07 mcdowellalex

I was getting this same error when publishing datasources from .tdsx files. I found that this only happened with datasources that existed with extracts, so when downloading I included the extracts and it seems to work fine

smallery avatar Oct 20 '22 15:10 smallery

I get the same error when I try to publish data sources without their extract. But I can't afford to download/unzip/zip/upload data sources with 25GB extracts. Any workaround?

rom1mouret avatar Nov 01 '22 04:11 rom1mouret

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.

Rchender avatar Nov 08 '22 21:11 Rchender

Same problem here... I can't use the include_extract=True.. it's a lot of data . I created the .tdsx file (tds + hyper) and didn't work

felipe-costa-compado avatar Jan 23 '23 19:01 felipe-costa-compado

I am not able to publish 351MB of hyper file even after using as_job=True in publish method getting same error . Can any one help me here

patilmadhu avatar Jul 13 '23 11:07 patilmadhu

I have the same error. Did anyone find something ?

rdeteix avatar Aug 22 '23 12:08 rdeteix

We face the same issue even with hyper files as small as in few hundred KBs. Is there a solution yet?

de-harish avatar Oct 20 '23 07:10 de-harish

Updating tableauserverclient worked for me.

rdeteix avatar Oct 20 '23 08:10 rdeteix

Updating tableauserverclient worked for me.

May I know the version that fixed the issue?

de-harish avatar Oct 20 '23 13:10 de-harish

I'm also facing the same issue. Was there any resolution for this?

PradeepDoddarangaiah avatar Jan 17 '24 03:01 PradeepDoddarangaiah

This is a pretty old issue with a lot of different reports. If anyone is still having a specific problem with publishing, please open a new issue with the details.

bcantoni avatar Sep 19 '24 21:09 bcantoni