tableauserverclient 0.34__py3-none-any.whl → 0.36__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. tableauserverclient/__init__.py +5 -1
  2. tableauserverclient/{_version.py → bin/_version.py} +3 -3
  3. tableauserverclient/models/connection_credentials.py +17 -1
  4. tableauserverclient/models/connection_item.py +38 -0
  5. tableauserverclient/models/custom_view_item.py +49 -5
  6. tableauserverclient/models/flow_item.py +49 -4
  7. tableauserverclient/models/group_item.py +40 -0
  8. tableauserverclient/models/job_item.py +65 -0
  9. tableauserverclient/models/project_item.py +39 -1
  10. tableauserverclient/models/task_item.py +30 -0
  11. tableauserverclient/models/view_item.py +55 -3
  12. tableauserverclient/models/webhook_item.py +33 -0
  13. tableauserverclient/models/workbook_item.py +26 -1
  14. tableauserverclient/server/endpoint/auth_endpoint.py +4 -2
  15. tableauserverclient/server/endpoint/custom_views_endpoint.py +197 -12
  16. tableauserverclient/server/endpoint/datasources_endpoint.py +14 -9
  17. tableauserverclient/server/endpoint/flows_endpoint.py +314 -0
  18. tableauserverclient/server/endpoint/groups_endpoint.py +325 -11
  19. tableauserverclient/server/endpoint/jobs_endpoint.py +109 -0
  20. tableauserverclient/server/endpoint/projects_endpoint.py +600 -0
  21. tableauserverclient/server/endpoint/tasks_endpoint.py +78 -0
  22. tableauserverclient/server/endpoint/views_endpoint.py +243 -2
  23. tableauserverclient/server/endpoint/webhooks_endpoint.py +77 -0
  24. tableauserverclient/server/endpoint/workbooks_endpoint.py +6 -4
  25. tableauserverclient/server/pager.py +24 -0
  26. tableauserverclient/server/request_factory.py +20 -1
  27. tableauserverclient/server/request_options.py +126 -2
  28. tableauserverclient/server/server.py +11 -1
  29. tableauserverclient/server/sort.py +14 -0
  30. {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/METADATA +3 -3
  31. {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/RECORD +35 -35
  32. {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/WHEEL +1 -1
  33. {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/LICENSE +0 -0
  34. {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/LICENSE.versioneer +0 -0
  35. {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/top_level.txt +0 -0
@@ -66,6 +66,25 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
66
66
  # Get all flows
67
67
  @api(version="3.3")
68
68
  def get(self, req_options: Optional["RequestOptions"] = None) -> tuple[list[FlowItem], PaginationItem]:
69
+ """
70
+ Get all flows on site. Returns a tuple of all flow items and pagination item.
71
+ This method is paginated, and returns one page of items per call. The
72
+ request options can be used to specify the page number, page size, as
73
+ well as sorting and filtering options.
74
+
75
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#query_flows_for_site
76
+
77
+ Parameters
78
+ ----------
79
+ req_options: Optional[RequestOptions]
80
+ An optional Request Options object that can be used to specify
81
+ sorting, filtering, and pagination options.
82
+
83
+ Returns
84
+ -------
85
+ tuple[list[FlowItem], PaginationItem]
86
+ A tuple of a list of flow items and a pagination item.
87
+ """
69
88
  logger.info("Querying all flows on site")
70
89
  url = self.baseurl
71
90
  server_response = self.get_request(url, req_options)
@@ -76,6 +95,21 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
76
95
  # Get 1 flow by id
77
96
  @api(version="3.3")
78
97
  def get_by_id(self, flow_id: str) -> FlowItem:
98
+ """
99
+ Get a single flow by id.
100
+
101
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#query_flow
102
+
103
+ Parameters
104
+ ----------
105
+ flow_id: str
106
+ The id of the flow to retrieve.
107
+
108
+ Returns
109
+ -------
110
+ FlowItem
111
+ The flow item that was retrieved.
112
+ """
79
113
  if not flow_id:
80
114
  error = "Flow ID undefined."
81
115
  raise ValueError(error)
@@ -87,6 +121,27 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
87
121
  # Populate flow item's connections
88
122
  @api(version="3.3")
89
123
  def populate_connections(self, flow_item: FlowItem) -> None:
124
+ """
125
+ Populate the connections for a flow item. This method will make a
126
+ request to the Tableau Server to get the connections associated with
127
+ the flow item and populate the connections property of the flow item.
128
+
129
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#query_flow_connections
130
+
131
+ Parameters
132
+ ----------
133
+ flow_item: FlowItem
134
+ The flow item to populate connections for.
135
+
136
+ Returns
137
+ -------
138
+ None
139
+
140
+ Raises
141
+ ------
142
+ MissingRequiredFieldError
143
+ If the flow item does not have an ID.
144
+ """
90
145
  if not flow_item.id:
91
146
  error = "Flow item missing ID. Flow must be retrieved from server first."
92
147
  raise MissingRequiredFieldError(error)
@@ -106,6 +161,25 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
106
161
  # Delete 1 flow by id
107
162
  @api(version="3.3")
108
163
  def delete(self, flow_id: str) -> None:
164
+ """
165
+ Delete a single flow by id.
166
+
167
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#delete_flow
168
+
169
+ Parameters
170
+ ----------
171
+ flow_id: str
172
+ The id of the flow to delete.
173
+
174
+ Returns
175
+ -------
176
+ None
177
+
178
+ Raises
179
+ ------
180
+ ValueError
181
+ If the flow_id is not defined.
182
+ """
109
183
  if not flow_id:
110
184
  error = "Flow ID undefined."
111
185
  raise ValueError(error)
@@ -116,6 +190,35 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
116
190
  # Download 1 flow by id
117
191
  @api(version="3.3")
118
192
  def download(self, flow_id: str, filepath: Optional[PathOrFileW] = None) -> PathOrFileW:
193
+ """
194
+ Download a single flow by id. The flow will be downloaded to the
195
+ specified file path. If no file path is specified, the flow will be
196
+ downloaded to the current working directory.
197
+
198
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#download_flow
199
+
200
+ Parameters
201
+ ----------
202
+ flow_id: str
203
+ The id of the flow to download.
204
+
205
+ filepath: Optional[PathOrFileW]
206
+ The file path to download the flow to. This can be a file path or
207
+ a file object. If a file object is passed, the flow will be written
208
+ to the file object. If a file path is passed, the flow will be
209
+ written to the file path. If no file path is specified, the flow
210
+ will be downloaded to the current working directory.
211
+
212
+ Returns
213
+ -------
214
+ PathOrFileW
215
+ The file path or file object that the flow was downloaded to.
216
+
217
+ Raises
218
+ ------
219
+ ValueError
220
+ If the flow_id is not defined.
221
+ """
119
222
  if not flow_id:
120
223
  error = "Flow ID undefined."
121
224
  raise ValueError(error)
@@ -144,6 +247,21 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
144
247
  # Update flow
145
248
  @api(version="3.3")
146
249
  def update(self, flow_item: FlowItem) -> FlowItem:
250
+ """
251
+ Updates the flow owner, project, description, and/or tags.
252
+
253
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#update_flow
254
+
255
+ Parameters
256
+ ----------
257
+ flow_item: FlowItem
258
+ The flow item to update.
259
+
260
+ Returns
261
+ -------
262
+ FlowItem
263
+ The updated flow item.
264
+ """
147
265
  if not flow_item.id:
148
266
  error = "Flow item missing ID. Flow must be retrieved from server first."
149
267
  raise MissingRequiredFieldError(error)
@@ -161,6 +279,25 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
161
279
  # Update flow connections
162
280
  @api(version="3.3")
163
281
  def update_connection(self, flow_item: FlowItem, connection_item: ConnectionItem) -> ConnectionItem:
282
+ """
283
+ Update a connection item for a flow item. This method will update the
284
+ connection details for the connection item associated with the flow.
285
+
286
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#update_flow_connection
287
+
288
+ Parameters
289
+ ----------
290
+ flow_item: FlowItem
291
+ The flow item that the connection is associated with.
292
+
293
+ connection_item: ConnectionItem
294
+ The connection item to update.
295
+
296
+ Returns
297
+ -------
298
+ ConnectionItem
299
+ The updated connection item.
300
+ """
164
301
  url = f"{self.baseurl}/{flow_item.id}/connections/{connection_item.id}"
165
302
 
166
303
  update_req = RequestFactory.Connection.update_req(connection_item)
@@ -172,6 +309,21 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
172
309
 
173
310
  @api(version="3.3")
174
311
  def refresh(self, flow_item: FlowItem) -> JobItem:
312
+ """
313
+ Runs the flow to refresh the data.
314
+
315
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#run_flow_now
316
+
317
+ Parameters
318
+ ----------
319
+ flow_item: FlowItem
320
+ The flow item to refresh.
321
+
322
+ Returns
323
+ -------
324
+ JobItem
325
+ The job item that was created to refresh the flow.
326
+ """
175
327
  url = f"{self.baseurl}/{flow_item.id}/run"
176
328
  empty_req = RequestFactory.Empty.empty_req()
177
329
  server_response = self.post_request(url, empty_req)
@@ -183,6 +335,35 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
183
335
  def publish(
184
336
  self, flow_item: FlowItem, file: PathOrFileR, mode: str, connections: Optional[list[ConnectionItem]] = None
185
337
  ) -> FlowItem:
338
+ """
339
+ Publishes a flow to the Tableau Server.
340
+
341
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#publish_flow
342
+
343
+ Parameters
344
+ ----------
345
+ flow_item: FlowItem
346
+ The flow item to publish. This item must have a project_id and name
347
+ defined.
348
+
349
+ file: PathOrFileR
350
+ The file path or file object to publish. This can be a .tfl or .tflx
351
+
352
+ mode: str
353
+ The publish mode. This can be "Overwrite" or "CreatNew". If the
354
+ mode is "Overwrite", the flow will be overwritten if it already
355
+ exists. If the mode is "CreateNew", a new flow will be created with
356
+ the same name as the flow item.
357
+
358
+ connections: Optional[list[ConnectionItem]]
359
+ A list of connection items to publish with the flow. If the flow
360
+ contains connections, they must be included in this list.
361
+
362
+ Returns
363
+ -------
364
+ FlowItem
365
+ The flow item that was published.
366
+ """
186
367
  if not mode or not hasattr(self.parent_srv.PublishMode, mode):
187
368
  error = "Invalid mode defined."
188
369
  raise ValueError(error)
@@ -265,30 +446,145 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
265
446
 
266
447
  @api(version="3.3")
267
448
  def populate_permissions(self, item: FlowItem) -> None:
449
+ """
450
+ Populate the permissions for a flow item. This method will make a
451
+ request to the Tableau Server to get the permissions associated with
452
+ the flow item and populate the permissions property of the flow item.
453
+
454
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#query_flow_permissions
455
+
456
+ Parameters
457
+ ----------
458
+ item: FlowItem
459
+ The flow item to populate permissions for.
460
+
461
+ Returns
462
+ -------
463
+ None
464
+ """
268
465
  self._permissions.populate(item)
269
466
 
270
467
  @api(version="3.3")
271
468
  def update_permissions(self, item: FlowItem, permission_item: Iterable["PermissionsRule"]) -> None:
469
+ """
470
+ Update the permissions for a flow item. This method will update the
471
+ permissions for the flow item. The permissions must be a list of
472
+ permissions rules. Will overwrite all existing permissions.
473
+
474
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_permissions_for_content
475
+
476
+ Parameters
477
+ ----------
478
+ item: FlowItem
479
+ The flow item to update permissions for.
480
+
481
+ permission_item: Iterable[PermissionsRule]
482
+ The permissions rules to update.
483
+
484
+ Returns
485
+ -------
486
+ None
487
+ """
272
488
  self._permissions.update(item, permission_item)
273
489
 
274
490
  @api(version="3.3")
275
491
  def delete_permission(self, item: FlowItem, capability_item: "PermissionsRule") -> None:
492
+ """
493
+ Delete a permission for a flow item. This method will delete only the
494
+ specified permission for the flow item.
495
+
496
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#delete_flow_permission
497
+
498
+ Parameters
499
+ ----------
500
+ item: FlowItem
501
+ The flow item to delete the permission from.
502
+
503
+ capability_item: PermissionsRule
504
+ The permission to delete.
505
+
506
+ Returns
507
+ -------
508
+ None
509
+ """
276
510
  self._permissions.delete(item, capability_item)
277
511
 
278
512
  @api(version="3.5")
279
513
  def populate_dqw(self, item: FlowItem) -> None:
514
+ """
515
+ Get information about Data Quality Warnings for a flow item.
516
+
517
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_metadata.htm#query_dqws
518
+
519
+ Parameters
520
+ ----------
521
+ item: FlowItem
522
+ The flow item to populate data quality warnings for.
523
+
524
+ Returns
525
+ -------
526
+ None
527
+ """
280
528
  self._data_quality_warnings.populate(item)
281
529
 
282
530
  @api(version="3.5")
283
531
  def update_dqw(self, item: FlowItem, warning: "DQWItem") -> None:
532
+ """
533
+ Update the warning type, status, and message of a data quality warning
534
+
535
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_metadata.htm#update_dqw
536
+
537
+ Parameters
538
+ ----------
539
+ item: FlowItem
540
+ The flow item to update data quality warnings for.
541
+
542
+ warning: DQWItem
543
+ The data quality warning to update.
544
+
545
+ Returns
546
+ -------
547
+ None
548
+ """
284
549
  return self._data_quality_warnings.update(item, warning)
285
550
 
286
551
  @api(version="3.5")
287
552
  def add_dqw(self, item: FlowItem, warning: "DQWItem") -> None:
553
+ """
554
+ Add a data quality warning to a flow.
555
+
556
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_metadata.htm#add_dqw
557
+
558
+ Parameters
559
+ ----------
560
+ item: FlowItem
561
+ The flow item to add data quality warnings to.
562
+
563
+ warning: DQWItem
564
+ The data quality warning to add.
565
+
566
+ Returns
567
+ -------
568
+ None
569
+ """
288
570
  return self._data_quality_warnings.add(item, warning)
289
571
 
290
572
  @api(version="3.5")
291
573
  def delete_dqw(self, item: FlowItem) -> None:
574
+ """
575
+ Delete all data quality warnings for a flow.
576
+
577
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_metadata.htm#delete_dqws
578
+
579
+ Parameters
580
+ ----------
581
+ item: FlowItem
582
+ The flow item to delete data quality warnings from.
583
+
584
+ Returns
585
+ -------
586
+ None
587
+ """
292
588
  self._data_quality_warnings.clear(item)
293
589
 
294
590
  # a convenience method
@@ -296,6 +592,24 @@ class Flows(QuerysetEndpoint[FlowItem], TaggingMixin[FlowItem]):
296
592
  def schedule_flow_run(
297
593
  self, schedule_id: str, item: FlowItem
298
594
  ) -> list["AddResponse"]: # actually should return a task
595
+ """
596
+ Schedule a flow to run on an existing schedule.
597
+
598
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_flow.htm#add_flow_task_to_schedule
599
+
600
+ Parameters
601
+ ----------
602
+ schedule_id: str
603
+ The id of the schedule to add the flow to.
604
+
605
+ item: FlowItem
606
+ The flow item to add to the schedule.
607
+
608
+ Returns
609
+ -------
610
+ list[AddResponse]
611
+ The response from the server.
612
+ """
299
613
  return self.parent_srv.schedules.add_to_schedule(schedule_id, flow=item)
300
614
 
301
615
  def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[FlowItem]: