tableau / server-client-python

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

server.tasks ValueError: name must be defined. #1237

Closed segunskl closed 5 months ago

segunskl commented 1 year ago

Describe the bug I can use this code to get all tasks in my tableau online since last year. But today this code return error like this. How to fix the error?

Versions Details of your environment, including:

To Reproduce Steps to reproduce the behavior. Please include a code snippet where possible.

server = TSC.Server(TABLEAU_URL, use_server_version=True)
server.auth.sign_in(tableau_auth)
all_tasks = list(TSC.Pager(server.tasks))

Results What are the results or error messages received?

image

NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.

stav-hacohen commented 1 year ago

We are facing the same issue. Seems like a change in tableau backend. Please advice.

pavel-sho commented 1 year ago

seems like element object <Element '{http://tableau.com/api}schedule' at 0x7fdda840e1d0> , returned object

schedule_xml.items()
[('frequency', 'Monthly'), ('nextRunAt', '2023-06-01T09:00:00Z')]

the name is not presented in the response from tableau.com

jacalata commented 1 year ago

Yes, it is a server change, the fix will be to remove the non-nullable attribute so the library accepts the new object.

pavel-sho commented 1 year ago

Hi @jacalata, is there a way to prioritize this bug or at least getting some ETA for a fix?

Thanks

CodingOnWindowsOS commented 1 year ago

@pavel-sho Out of curiosity, is this supposed to return flow tasks as well? When I attempt to retrieve all tasks, I can only ever retrieve those associated with Extract Refreshes, despite being able to view those associated with Flows, Subscriptions, Alerts, and Linked Task on Tableau Server's front-end as a site admin.

pavel-sho commented 1 year ago

Hi @SQLShortReads, you right, the purpose we use tasks service, is to check which workbook_id / datasource_id has incremental refresh, if there is any we trigger it, as part of orchestration we do via Airflow, currently Tableau supports only full refresh when using their Airflow Operator, supporting incremental refresh require some dirty tricks.

ghost commented 1 year ago

Hey all, because I keep getting the short end with Tableau Support (a repeat trend for my org, how about you all?), I made a hotfix for this. Check the PR out above, there's only a few small changes you need to do to fix this bug.

If you need to apply it yourself to patch a pip installed copy and don't know how to make a modified package from a git yourself, here's my lazy approach:

  1. in windows file explorer, go to %appdata%\Python\Python310\site-packages\tableauserverclient\models\
  2. (if you're not using Python 3.10 or have it installed elsewhere, change the URI as needed)
  3. Replace the schedule_item.py file there with the file from the pull request.
  4. Restart whatever code/program you're running, so your python environment refreshes.
CodingOnWindowsOS commented 1 year ago

Has anyone been able to successfully retrieve data on scheduled flow tasks? As previously stated, only extractRefresh tasks seem to be returned by server.tasks.

To be clear, in the front-end UI, there are 6 categories of tasks, and server.tasks only returns those tasks that are of Extract Refresh type. Extract Refreshes Flows Subscriptions Alerts Accelerated Views Linked Tasks.