@@ -30,6 +30,23 @@ def siteurl(self) -> str:
30
30
31
31
@api (version = "2.3" )
32
32
def get (self , req_options : Optional ["RequestOptions" ] = None ) -> tuple [list [ScheduleItem ], PaginationItem ]:
33
+ """
34
+ Returns a list of flows, extract, and subscription server schedules on
35
+ Tableau Server. For each schedule, the API returns name, frequency,
36
+ priority, and other information.
37
+
38
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#query_schedules
39
+
40
+ Parameters
41
+ ----------
42
+ req_options : Optional[RequestOptions]
43
+ Filtering and paginating options for request.
44
+
45
+ Returns
46
+ -------
47
+ Tuple[List[ScheduleItem], PaginationItem]
48
+ A tuple of list of ScheduleItem and PaginationItem
49
+ """
33
50
logger .info ("Querying all schedules" )
34
51
url = self .baseurl
35
52
server_response = self .get_request (url , req_options )
@@ -38,7 +55,22 @@ def get(self, req_options: Optional["RequestOptions"] = None) -> tuple[list[Sche
38
55
return all_schedule_items , pagination_item
39
56
40
57
@api (version = "3.8" )
41
- def get_by_id (self , schedule_id ):
58
+ def get_by_id (self , schedule_id : str ) -> ScheduleItem :
59
+ """
60
+ Returns detailed information about the specified server schedule.
61
+
62
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#get-schedule
63
+
64
+ Parameters
65
+ ----------
66
+ schedule_id : str
67
+ The ID of the schedule to get information for.
68
+
69
+ Returns
70
+ -------
71
+ ScheduleItem
72
+ The schedule item that corresponds to the given ID.
73
+ """
42
74
if not schedule_id :
43
75
error = "No Schedule ID provided"
44
76
raise ValueError (error )
@@ -49,6 +81,20 @@ def get_by_id(self, schedule_id):
49
81
50
82
@api (version = "2.3" )
51
83
def delete (self , schedule_id : str ) -> None :
84
+ """
85
+ Deletes the specified schedule from the server.
86
+
87
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#delete_schedule
88
+
89
+ Parameters
90
+ ----------
91
+ schedule_id : str
92
+ The ID of the schedule to delete.
93
+
94
+ Returns
95
+ -------
96
+ None
97
+ """
52
98
if not schedule_id :
53
99
error = "Schedule ID undefined"
54
100
raise ValueError (error )
@@ -58,6 +104,23 @@ def delete(self, schedule_id: str) -> None:
58
104
59
105
@api (version = "2.3" )
60
106
def update (self , schedule_item : ScheduleItem ) -> ScheduleItem :
107
+ """
108
+ Modifies settings for the specified server schedule, including the name,
109
+ priority, and frequency details on Tableau Server. For Tableau Cloud,
110
+ see the tasks and subscritpions API.
111
+
112
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#update_schedule
113
+
114
+ Parameters
115
+ ----------
116
+ schedule_item : ScheduleItem
117
+ The schedule item to update.
118
+
119
+ Returns
120
+ -------
121
+ ScheduleItem
122
+ The updated schedule item.
123
+ """
61
124
if not schedule_item .id :
62
125
error = "Schedule item missing ID."
63
126
raise MissingRequiredFieldError (error )
@@ -71,6 +134,20 @@ def update(self, schedule_item: ScheduleItem) -> ScheduleItem:
71
134
72
135
@api (version = "2.3" )
73
136
def create (self , schedule_item : ScheduleItem ) -> ScheduleItem :
137
+ """
138
+ Creates a new server schedule on Tableau Server. For Tableau Cloud, use
139
+ the tasks and subscriptions API.
140
+
141
+ Parameters
142
+ ----------
143
+ schedule_item : ScheduleItem
144
+ The schedule item to create.
145
+
146
+ Returns
147
+ -------
148
+ ScheduleItem
149
+ The newly created schedule.
150
+ """
74
151
if schedule_item .interval_item is None :
75
152
error = "Interval item must be defined."
76
153
raise MissingRequiredFieldError (error )
@@ -92,6 +169,41 @@ def add_to_schedule(
92
169
flow : Optional ["FlowItem" ] = None ,
93
170
task_type : Optional [str ] = None ,
94
171
) -> list [AddResponse ]:
172
+ """
173
+ Adds a workbook, datasource, or flow to a schedule on Tableau Server.
174
+ Only one of workbook, datasource, or flow can be passed in at a time.
175
+
176
+ The task type is optional and will default to ExtractRefresh if a
177
+ workbook or datasource is passed in, and RunFlow if a flow is passed in.
178
+
179
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#add_workbook_to_schedule
180
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#add_data_source_to_schedule
181
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#add_flow_task_to_schedule
182
+
183
+ Parameters
184
+ ----------
185
+ schedule_id : str
186
+ The ID of the schedule to add the item to.
187
+
188
+ workbook : Optional[WorkbookItem]
189
+ The workbook to add to the schedule.
190
+
191
+ datasource : Optional[DatasourceItem]
192
+ The datasource to add to the schedule.
193
+
194
+ flow : Optional[FlowItem]
195
+ The flow to add to the schedule.
196
+
197
+ task_type : Optional[str]
198
+ The type of task to add to the schedule. If not provided, it will
199
+ default to ExtractRefresh if a workbook or datasource is passed in,
200
+ and RunFlow if a flow is passed in.
201
+
202
+ Returns
203
+ -------
204
+ list[AddResponse]
205
+ A list of responses for each item added to the schedule.
206
+ """
95
207
# There doesn't seem to be a good reason to allow one item of each type?
96
208
if workbook and datasource :
97
209
warnings .warn ("Passing in multiple items for add_to_schedule will be deprecated" , PendingDeprecationWarning )
0 commit comments