We cannot create schedules with a MonthlyInterval, looking at the code it forces the interval to be a tuple.
Tableau Support: https://help.salesforce.com/s/case-view?caseId=500Hx00000kv6hJIAQ
Describe the bug A clear and concise description of what the bug is.
We cannot create schedules with a MonthlyInterval, looking at the code it forces the interval to be a tuple.
Versions Details of your environment, including:
- Tableau Server version (or note if using Tableau Online)
-
Tableau Server Version: 2022.3.9 (20223.23.0811.1400) 64-bit Linux. -
Tableau Server Version: 2024.2.2 (20242.24.0807.0327) 64-bit Linux
-
- Python version
-
Python 3.12.6.
-
- TSC library version
-
tableauserverclient-0.36
-
To Reproduce Steps to reproduce the behavior. Please include a code snippet where possible.
tableau_auth = TSC.PersonalAccessTokenAuth(tableau_username, tableau_password)
server = TSC.Server(tableau_server, use_server_version=True)
with server.auth.sign_in(tableau_auth):
schedule = TSC.ScheduleItem(
name="my_test_schedule",
priority=50,
schedule_type=TSC.ScheduleItem.Type.Extract,
execution_order=TSC.ScheduleItem.ExecutionOrder.Parallel,
interval_item=TSC.MonthlyInterval(time(5, 30), 5),
)
new_schedule = server.schedules.create(schedule)
Results What are the results or error messages received?
Traceback (most recent call last):
File "/MY_REPO/_develop_schedules.py", line 86, in <module>
new_schedule = server.schedules.create(schedule)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/VENV_PYTHON_PATH/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 274, in wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/VENV_PYTHON_PATH/site-packages/tableauserverclient/server/endpoint/schedules_endpoint.py", line 80, in create
server_response = self.post_request(url, create_req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/VENV_PYTHON_PATH/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 226, in post_request
return self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/VENV_PYTHON_PATH/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 141, in _make_request
self._check_status(server_response, url)
File "/VENV_PYTHON_PATH/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 166, in _check_status
raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace, url)
tableauserverclient.server.endpoint.exceptions.ServerResponseError:
409004: Bad Request
Schedule monthDay must be either an integer between 1 and 31 or 'LastDay'.
Somewhat related, in the sense that the time interval handling seems a bit wobbly: https://github.com/tableau/server-client-python/issues/1508
Since MonthlyInterval forces interval_value to be tuple, the schedules endpoint creates XML with an invalid monthDay value. For example, a Monthly schedule example from the official documentation forms the following request, and hence we get Bad Request error.
<tsRequest> <schedule name="Monthly-Schedule" priority="80" type="Extract" executionOrder="Parallel" frequency="Monthly"> <frequencyDetails start="23:30:00"> <intervals> <interval monthDay="(15,)" /> </intervals> </frequencyDetails> </schedule> </tsRequest>
The same issue with server.schedules.update method.
UPD: I see that the issue was actually fixed and merged into the master branch, but it was never included in any release, and the issue still persists in 0.38. Hopefully, we will see it in the next releases.