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

server.tasks ValueError: name must be defined.

Open segunskl opened this issue 2 years ago • 8 comments

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:

  • Tableau Server version (or note if using Tableau Online) > Tableau Online
  • Python version > 3.8
  • TSC library version > 0.25

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.

segunskl avatar May 24 '23 06:05 segunskl

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

stav-hacohen avatar May 24 '23 09:05 stav-hacohen

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

pavel-sho avatar May 24 '23 11:05 pavel-sho

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

jacalata avatar May 24 '23 18:05 jacalata

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

Thanks

pavel-sho avatar May 28 '23 09:05 pavel-sho

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

CodingOnWindowsOS avatar May 30 '23 15:05 CodingOnWindowsOS

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.

pavel-sho avatar May 31 '23 12:05 pavel-sho

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.

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.

CodingOnWindowsOS avatar Jul 18 '23 17:07 CodingOnWindowsOS