tableau / hyper-api-samples

Sample code to get started with the Hyper API.
https://help.tableau.com/current/api/hyper_api/en-us/index.html
MIT License
132 stars 71 forks source link

File is locked #95

Open pakosel opened 1 year ago

pakosel commented 1 year ago

Hi, Thanks for sharing these examples, they are great. Most of the time all works perfectly but from time to time I'm getting the following error when trying to open the connection to .hyper file: Tableau.HyperAPI.HyperException: error opening database 'xxxxx': There was an error during loading database: The database file is locked by another process: DatabaseId: 'xxxxxx'

This concerns the situation when a user browses Tableau Server workbook that refers to the same Data Source as I'm trying to access via a code - but even if the user closes a browser, the lock on the .hyper file remains for about 30 more minutes. Does anyone know how to overcome the locking issues? Thanks,

jkammerer commented 1 year ago

Hello, are you opening the .hyper files on the same machine on which Tableau Server is running?

pakosel commented 1 year ago

Hi, Yes, that's exactly my use case - is it supported scenario?

jkammerer commented 1 year ago

I think that it will be hard to get this to work reliably since the files could always be opened by some user. The supported way to access the hyper files would be to use the Tableau Server REST API to download the datasource, edit this downloaded copy and then publish it again via the REST API. That way you also don't have to do it on the same machine.

pakosel commented 1 year ago

Thanks for the hint but this might be also a problem since the hyper file is several GB of size.... Not even sure if REST API from Tableau could handle downloading such a massive files

vogelsgesang commented 1 year ago

There is also the "Hyper Update Rest API" through which you can modify parts of a Hyper file through the REST API.

You can find an example in https://github.com/tableau/hyper-api-samples/blob/main/Community-Supported/flights-data-incremental-refresh/flights-data-incremental-refresh.py