Error:- ValueError: invalid literal for int() with base 10: 'Second'
# Name of the data source in tableau
datasource = sys.argv[1]
tableau_auth = tsc.PersonalAccessTokenAuth(
token_name=personal_access_token_name,
personal_access_token=personal_access_token_secret,
site_id=site
)
server = tsc.Server(tableau_server, use_server_version=True)
server.auth.sign_in(tableau_auth)
# Get datasource id from datasource name
req_option = tsc.RequestOptions(pagesize=1000)
req_option.filter.update([tsc.Filter(tsc.RequestOptions.Field.Name, tsc.RequestOptions.Operator.Equals, datasource)])
all_datasources = list(tsc.Pager(server.datasources, req_option))
datasource_id = all_datasources[0].id
# Get 1000 tasks and then filter for only extract tasks under the datasource id of interest
# I don't believe you can filter tasks
all_extracts = list(tsc.Pager(server.tasks, tsc.RequestOptions(pagesize=1000)))
# The task type for incremental extracts is 'IncrementExtractTask' and full extracts is 'extractRefresh'
# The task type for incremental exrracts via Bridges is 'IncrementExtractViaBridgeTask'
extracts = [i for i in all_extracts if (i.target is not None and i.target.id == datasource_id) and ('IncrementExtractViaBridgeTask' == i.task_type)]
incremental_extract_obj = extracts[0]
# Trigger the incremental extract associated with the datasource
update_xml = server.tasks.run(incremental_extract_obj)
job_id = xmltodict.parse(update_xml)['tsResponse']['job']['@id']
print(f"Refresh extract job {job_id} created")
C:\>D:\Python\python.exe C:\TableauPythonScripts\TableauExtractIncRefTrigScript.py Datasource_name
==================
Traceback (most recent call last):
File "D:\Python\lib\site-packages\tableauserverclient\models\interval_item.py", line 183, in interval
if not (1 <= int(interval_value) <= 31):
ValueError: invalid literal for int() with base 10: 'Second'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\TableauPythonScripts\TableauExtractIncRefTrigScript.py", line 31, in <module>
all_extracts = list(tsc.Pager(server.tasks, tsc.RequestOptions(pagesize=1000)))
File "D:\Python\lib\site-packages\tableauserverclient\server\pager.py", line 40, in __iter__
current_item_list, last_pagination_item = self._endpoint(self._options)
File "D:\Python\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 190, in wrapper
return func(self, *args, **kwargs)
File "D:\Python\lib\site-packages\tableauserverclient\server\endpoint\tasks_endpoint.py", line 36, in get
all_tasks = TaskItem.from_response(server_response.content, self.parent_srv.namespace, task_type)
File "D:\Python\lib\site-packages\tableauserverclient\models\task_item.py", line 53, in from_response
return list(all_tasks)
File "D:\Python\lib\site-packages\tableauserverclient\models\task_item.py", line 51, in <genexpr>
all_tasks = (TaskItem._parse_element(x, ns) for x in all_tasks_xml)
File "D:\Python\lib\site-packages\tableauserverclient\models\task_item.py", line 64, in _parse_element
schedule_item_list = ScheduleItem.from_element(element, ns)
File "D:\Python\lib\site-packages\tableauserverclient\models\schedule_item.py", line 223, in from_element
) = cls._parse_element(schedule_xml, ns)
File "D:\Python\lib\site-packages\tableauserverclient\models\schedule_item.py", line 298, in _parse_element
interval_item = ScheduleItem._parse_interval_item(frequency_detail_elem, frequency, ns)
File "D:\Python\lib\site-packages\tableauserverclient\models\schedule_item.py", line 276, in _parse_interval_item
return MonthlyInterval(start_time, interval_value)
File "D:\Python\lib\site-packages\tableauserverclient\models\interval_item.py", line 151, in __init__
self.interval = str(interval_value)
File "D:\Python\lib\site-packages\tableauserverclient\models\interval_item.py", line 187, in interval
raise ValueError(error)
ValueError: Invalid interval value for a monthly frequency: Second.
Describe the bug
When calling the IncrementalExtract refresh bridge refresh script as mentioned below We are getting below error. This worked successfully until last week.
Versions
Details of your environment, including:
Tableau Online
Python version: 3.8
TSC library version 3.22
To Reproduce
Steps to reproduce the behavior. Please include a code snippet where possible.
Results
What are the results or error messages received?