tableauserverclient 0.35__py3-none-any.whl → 0.37__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.
@@ -6,10 +6,11 @@ import os
6
6
 
7
7
  from contextlib import closing
8
8
  from pathlib import Path
9
- from typing import Optional, TYPE_CHECKING, Union
9
+ from typing import Literal, Optional, TYPE_CHECKING, Union, overload
10
10
  from collections.abc import Iterable, Mapping, Sequence
11
11
 
12
12
  from tableauserverclient.helpers.headers import fix_filename
13
+ from tableauserverclient.models.dqw_item import DQWItem
13
14
  from tableauserverclient.server.query import QuerySet
14
15
 
15
16
  if TYPE_CHECKING:
@@ -71,6 +72,28 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
71
72
  # Get all datasources
72
73
  @api(version="2.0")
73
74
  def get(self, req_options: Optional[RequestOptions] = None) -> tuple[list[DatasourceItem], PaginationItem]:
75
+ """
76
+ Returns a list of published data sources on the specified site, with
77
+ optional parameters for specifying the paging of large results. To get
78
+ a list of data sources embedded in a workbook, use the Query Workbook
79
+ Connections method.
80
+
81
+ Endpoint is paginated, and will return one page per call.
82
+
83
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#query_data_sources
84
+
85
+ Parameters
86
+ ----------
87
+ req_options : Optional[RequestOptions]
88
+ Optional parameters for the request, such as filters, sorting, page
89
+ size, and page number.
90
+
91
+ Returns
92
+ -------
93
+ tuple[list[DatasourceItem], PaginationItem]
94
+ A tuple containing the list of datasource items and pagination
95
+ information.
96
+ """
74
97
  logger.info("Querying all datasources on site")
75
98
  url = self.baseurl
76
99
  server_response = self.get_request(url, req_options)
@@ -81,6 +104,21 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
81
104
  # Get 1 datasource by id
82
105
  @api(version="2.0")
83
106
  def get_by_id(self, datasource_id: str) -> DatasourceItem:
107
+ """
108
+ Returns information about a specific data source.
109
+
110
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#query_data_source
111
+
112
+ Parameters
113
+ ----------
114
+ datasource_id : str
115
+ The unique ID of the datasource to retrieve.
116
+
117
+ Returns
118
+ -------
119
+ DatasourceItem
120
+ An object containing information about the datasource.
121
+ """
84
122
  if not datasource_id:
85
123
  error = "Datasource ID undefined."
86
124
  raise ValueError(error)
@@ -92,6 +130,20 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
92
130
  # Populate datasource item's connections
93
131
  @api(version="2.0")
94
132
  def populate_connections(self, datasource_item: DatasourceItem) -> None:
133
+ """
134
+ Retrieve connection information for the specificed datasource item.
135
+
136
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#query_data_source_connections
137
+
138
+ Parameters
139
+ ----------
140
+ datasource_item : DatasourceItem
141
+ The datasource item to retrieve connections for.
142
+
143
+ Returns
144
+ -------
145
+ None
146
+ """
95
147
  if not datasource_item.id:
96
148
  error = "Datasource item missing ID. Datasource must be retrieved from server first."
97
149
  raise MissingRequiredFieldError(error)
@@ -116,6 +168,22 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
116
168
  # Delete 1 datasource by id
117
169
  @api(version="2.0")
118
170
  def delete(self, datasource_id: str) -> None:
171
+ """
172
+ Deletes the specified data source from a site. When a data source is
173
+ deleted, its associated data connection is also deleted. Workbooks that
174
+ use the data source are not deleted, but they will no longer work
175
+ properly.
176
+
177
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#delete_data_source
178
+
179
+ Parameters
180
+ ----------
181
+ datasource_id : str
182
+
183
+ Returns
184
+ -------
185
+ None
186
+ """
119
187
  if not datasource_id:
120
188
  error = "Datasource ID undefined."
121
189
  raise ValueError(error)
@@ -133,6 +201,29 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
133
201
  filepath: Optional[PathOrFileW] = None,
134
202
  include_extract: bool = True,
135
203
  ) -> PathOrFileW:
204
+ """
205
+ Downloads the specified data source from a site. The data source is
206
+ downloaded as a .tdsx file.
207
+
208
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#download_data_source
209
+
210
+ Parameters
211
+ ----------
212
+ datasource_id : str
213
+ The unique ID of the datasource to download.
214
+
215
+ filepath : Optional[PathOrFileW]
216
+ The file path to save the downloaded datasource to. If not
217
+ specified, the file will be saved to the current working directory.
218
+
219
+ include_extract : bool, default True
220
+ If True, the extract is included in the download. If False, the
221
+ extract is not included.
222
+
223
+ Returns
224
+ -------
225
+ filepath : PathOrFileW
226
+ """
136
227
  return self.download_revision(
137
228
  datasource_id,
138
229
  None,
@@ -143,6 +234,28 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
143
234
  # Update datasource
144
235
  @api(version="2.0")
145
236
  def update(self, datasource_item: DatasourceItem) -> DatasourceItem:
237
+ """
238
+ Updates the owner, project or certification status of the specified
239
+ data source.
240
+
241
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#update_data_source
242
+
243
+ Parameters
244
+ ----------
245
+ datasource_item : DatasourceItem
246
+ The datasource item to update.
247
+
248
+ Returns
249
+ -------
250
+ DatasourceItem
251
+ An object containing information about the updated datasource.
252
+
253
+ Raises
254
+ ------
255
+ MissingRequiredFieldError
256
+ If the datasource item is missing an ID.
257
+ """
258
+
146
259
  if not datasource_item.id:
147
260
  error = "Datasource item missing ID. Datasource must be retrieved from server first."
148
261
  raise MissingRequiredFieldError(error)
@@ -171,6 +284,26 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
171
284
  def update_connection(
172
285
  self, datasource_item: DatasourceItem, connection_item: ConnectionItem
173
286
  ) -> Optional[ConnectionItem]:
287
+ """
288
+ Updates the server address, port, username, or password for the
289
+ specified data source connection.
290
+
291
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#update_data_source_connection
292
+
293
+ Parameters
294
+ ----------
295
+ datasource_item : DatasourceItem
296
+ The datasource item to update.
297
+
298
+ connection_item : ConnectionItem
299
+ The connection item to update.
300
+
301
+ Returns
302
+ -------
303
+ Optional[ConnectionItem]
304
+ An object containing information about the updated connection.
305
+ """
306
+
174
307
  url = f"{self.baseurl}/{datasource_item.id}/connections/{connection_item.id}"
175
308
 
176
309
  update_req = RequestFactory.Connection.update_req(connection_item)
@@ -188,15 +321,51 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
188
321
 
189
322
  @api(version="2.8")
190
323
  def refresh(self, datasource_item: DatasourceItem, incremental: bool = False) -> JobItem:
324
+ """
325
+ Refreshes the extract of an existing workbook.
326
+
327
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#run_extract_refresh_task
328
+
329
+ Parameters
330
+ ----------
331
+ workbook_item : WorkbookItem | str
332
+ The workbook item or workbook ID.
333
+ incremental: bool
334
+ Whether to do a full refresh or incremental refresh of the extract data
335
+
336
+ Returns
337
+ -------
338
+ JobItem
339
+ The job item.
340
+ """
191
341
  id_ = getattr(datasource_item, "id", datasource_item)
192
342
  url = f"{self.baseurl}/{id_}/refresh"
193
- refresh_req = RequestFactory.Task.refresh_req(incremental)
343
+ refresh_req = RequestFactory.Task.refresh_req(incremental, self.parent_srv)
194
344
  server_response = self.post_request(url, refresh_req)
195
345
  new_job = JobItem.from_response(server_response.content, self.parent_srv.namespace)[0]
196
346
  return new_job
197
347
 
198
348
  @api(version="3.5")
199
349
  def create_extract(self, datasource_item: DatasourceItem, encrypt: bool = False) -> JobItem:
350
+ """
351
+ Create an extract for a data source in a site. Optionally, encrypt the
352
+ extract if the site and workbooks using it are configured to allow it.
353
+
354
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_extract_and_encryption.htm#create_extract_for_datasource
355
+
356
+ Parameters
357
+ ----------
358
+ datasource_item : DatasourceItem | str
359
+ The datasource item or datasource ID.
360
+
361
+ encrypt : bool, default False
362
+ Whether to encrypt the extract.
363
+
364
+ Returns
365
+ -------
366
+ JobItem
367
+ The job item.
368
+ """
200
369
  id_ = getattr(datasource_item, "id", datasource_item)
201
370
  url = f"{self.baseurl}/{id_}/createExtract?encrypt={encrypt}"
202
371
  empty_req = RequestFactory.Empty.empty_req()
@@ -206,11 +375,49 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
206
375
 
207
376
  @api(version="3.5")
208
377
  def delete_extract(self, datasource_item: DatasourceItem) -> None:
378
+ """
379
+ Delete the extract of a data source in a site.
380
+
381
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_extract_and_encryption.htm#delete_extract_from_datasource
382
+
383
+ Parameters
384
+ ----------
385
+ datasource_item : DatasourceItem | str
386
+ The datasource item or datasource ID.
387
+
388
+ Returns
389
+ -------
390
+ None
391
+ """
209
392
  id_ = getattr(datasource_item, "id", datasource_item)
210
393
  url = f"{self.baseurl}/{id_}/deleteExtract"
211
394
  empty_req = RequestFactory.Empty.empty_req()
212
395
  self.post_request(url, empty_req)
213
396
 
397
+ @overload
398
+ def publish(
399
+ self,
400
+ datasource_item: DatasourceItem,
401
+ file: PathOrFileR,
402
+ mode: str,
403
+ connection_credentials: Optional[ConnectionCredentials] = None,
404
+ connections: Optional[Sequence[ConnectionItem]] = None,
405
+ as_job: Literal[False] = False,
406
+ ) -> DatasourceItem:
407
+ pass
408
+
409
+ @overload
410
+ def publish(
411
+ self,
412
+ datasource_item: DatasourceItem,
413
+ file: PathOrFileR,
414
+ mode: str,
415
+ connection_credentials: Optional[ConnectionCredentials] = None,
416
+ connections: Optional[Sequence[ConnectionItem]] = None,
417
+ as_job: Literal[True] = True,
418
+ ) -> JobItem:
419
+ pass
420
+
214
421
  # Publish datasource
215
422
  @api(version="2.0")
216
423
  @parameter_added_in(connections="2.8")
@@ -224,6 +431,50 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
224
431
  connections: Optional[Sequence[ConnectionItem]] = None,
225
432
  as_job: bool = False,
226
433
  ) -> Union[DatasourceItem, JobItem]:
434
+ """
435
+ Publishes a data source to a server, or appends data to an existing
436
+ data source.
437
+
438
+ This method checks the size of the data source and automatically
439
+ determines whether the publish the data source in multiple parts or in
440
+ one operation.
441
+
442
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#publish_data_source
443
+
444
+ Parameters
445
+ ----------
446
+ datasource_item : DatasourceItem
447
+ The datasource item to publish. The fields for name and project_id
448
+ are required.
449
+
450
+ file : PathOrFileR
451
+ The file path or file object to publish.
452
+
453
+ mode : str
454
+ Specifies whether you are publishing a new datasource (CreateNew),
455
+ overwriting an existing datasource (Overwrite), or add to an
456
+ existing datasource (Append). You can also use the publish mode
457
+ attributes, for example: TSC.Server.PublishMode.Overwrite.
458
+
459
+ connection_credentials : Optional[ConnectionCredentials]
460
+ The connection credentials to use when publishing the datasource.
461
+ Mutually exclusive with the connections parameter.
462
+
463
+ connections : Optional[Sequence[ConnectionItem]]
464
+ The connections to use when publishing the datasource. Mutually
465
+ exclusive with the connection_credentials parameter.
466
+
467
+ as_job : bool, default False
468
+ If True, the publish operation is asynchronous and returns a job
469
+ item. If False, the publish operation is synchronous and returns a
470
+ datasource item.
471
+
472
+ Returns
473
+ -------
474
+ Union[DatasourceItem, JobItem]
475
+ The datasource item or job item.
476
+
477
+ """
227
478
  if isinstance(file, (os.PathLike, str)):
228
479
  if not os.path.isfile(file):
229
480
  error = "File path does not lead to an existing file."
@@ -328,6 +579,51 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
328
579
  actions: Sequence[Mapping],
329
580
  payload: Optional[FilePath] = None,
330
581
  ) -> JobItem:
582
+ """
583
+ Incrementally updates data (insert, update, upsert, replace and delete)
584
+ in a published data source from a live-to-Hyper connection, where the
585
+ data source has multiple connections.
586
+
587
+ A live-to-Hyper connection has a Hyper or Parquet formatted
588
+ file/database as the origin of its data.
589
+
590
+ For all connections to Parquet files, and for any data sources with a
591
+ single connection generally, you can use the Update Data in Hyper Data
592
+ Source method without specifying the connection-id.
593
+
594
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#update_data_in_hyper_connection
595
+
596
+ Parameters
597
+ ----------
598
+ datasource_or_connection_item : Union[DatasourceItem, ConnectionItem, str]
599
+ The datasource item, connection item, or datasource ID. Either a
600
+ DataSourceItem or a ConnectionItem. If the datasource only contains
601
+ a single connection, the DataSourceItem is sufficient to identify
602
+ which data should be updated. Otherwise, for datasources with
603
+ multiple connections, a ConnectionItem must be provided.
604
+
605
+ request_id : str
606
+ User supplied arbitrary string to identify the request. A request
607
+ identified with the same key will only be executed once, even if
608
+ additional requests using the key are made, for instance, due to
609
+ retries when facing network issues.
610
+
611
+ actions : Sequence[Mapping]
612
+ A list of actions (insert, update, delete, ...) specifying how to
613
+ modify the data within the published datasource. For more
614
+ information on the actions, see: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_how_to_update_data_to_hyper.htm#action-batch-descriptions
615
+
616
+ payload : Optional[FilePath]
617
+ A Hyper file containing tuples to be inserted/deleted/updated or
618
+ other payload data used by the actions. Hyper files can be created
619
+ using the Tableau Hyper API or pantab.
620
+
621
+ Returns
622
+ -------
623
+ JobItem
624
+ The job running on the server.
625
+
626
+ """
331
627
  if isinstance(datasource_or_connection_item, DatasourceItem):
332
628
  datasource_id = datasource_or_connection_item.id
333
629
  url = f"{self.baseurl}/{datasource_id}/data"
@@ -356,35 +652,179 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
356
652
 
357
653
  @api(version="2.0")
358
654
  def populate_permissions(self, item: DatasourceItem) -> None:
655
+ """
656
+ Populates the permissions on the specified datasource item.
657
+
658
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#query_data_source_permissions
659
+
660
+ Parameters
661
+ ----------
662
+ item : DatasourceItem
663
+ The datasource item to populate permissions for.
664
+
665
+ Returns
666
+ -------
667
+ None
668
+ """
359
669
  self._permissions.populate(item)
360
670
 
361
671
  @api(version="2.0")
362
672
  def update_permissions(self, item: DatasourceItem, permission_item: list["PermissionsRule"]) -> None:
673
+ """
674
+ Updates the permissions on the specified datasource item. This method
675
+ overwrites all existing permissions. Any permissions not included in
676
+ the list will be removed.
677
+
678
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#replace_permissions_for_content
679
+
680
+ Parameters
681
+ ----------
682
+ item : DatasourceItem
683
+ The datasource item to update permissions for.
684
+
685
+ permission_item : list[PermissionsRule]
686
+ The permissions to apply to the datasource item.
687
+
688
+ Returns
689
+ -------
690
+ None
691
+ """
363
692
  self._permissions.update(item, permission_item)
364
693
 
365
694
  @api(version="2.0")
366
695
  def delete_permission(self, item: DatasourceItem, capability_item: "PermissionsRule") -> None:
696
+ """
697
+ Deletes a single permission rule from the specified datasource item.
698
+
699
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_permissions.htm#delete_data_source_permissionDatasourceItem
700
+
701
+ Parameters
702
+ ----------
703
+ item : DatasourceItem
704
+ The datasource item to delete permissions from.
705
+
706
+ capability_item : PermissionsRule
707
+ The permission rule to delete.
708
+
709
+ Returns
710
+ -------
711
+ None
712
+ """
367
713
  self._permissions.delete(item, capability_item)
368
714
 
369
715
  @api(version="3.5")
370
- def populate_dqw(self, item):
716
+ def populate_dqw(self, item) -> None:
717
+ """
718
+ Get information about the data quality warning for the database, table,
719
+ column, published data source, flow, virtual connection, or virtual
720
+ connection table.
721
+
722
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_metadata.htm#query_dqws
723
+
724
+ Parameters
725
+ ----------
726
+ item : DatasourceItem
727
+ The datasource item to populate data quality warnings for.
728
+
729
+ Returns
730
+ -------
731
+ None
732
+ """
371
733
  self._data_quality_warnings.populate(item)
372
734
 
373
735
  @api(version="3.5")
374
736
  def update_dqw(self, item, warning):
737
+ """
738
+ Update the warning type, status, and message of a data quality warning.
739
+
740
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_metadata.htm#update_dqw
741
+
742
+ Parameters
743
+ ----------
744
+ item : DatasourceItem
745
+ The datasource item to update data quality warnings for.
746
+
747
+ warning : DQWItem
748
+ The data quality warning to update.
749
+
750
+ Returns
751
+ -------
752
+ DQWItem
753
+ The updated data quality warning.
754
+ """
375
755
  return self._data_quality_warnings.update(item, warning)
376
756
 
377
757
  @api(version="3.5")
378
758
  def add_dqw(self, item, warning):
759
+ """
760
+ Add a data quality warning to a datasource.
761
+
762
+ The Add Data Quality Warning method adds a data quality warning to an
763
+ asset. (An automatically-generated monitoring warning does not count
764
+ towards this limit.) In Tableau Cloud February 2024 and Tableau Server
765
+ 2024.2 and earlier, adding a data quality warning to an asset that
766
+ already has one causes an error.
767
+
768
+ This method is available if your Tableau Cloud site or Tableau Server is licensed with Data Management.
769
+
770
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_metadata.htm#add_dqw
771
+
772
+ Parameters
773
+ ----------
774
+ item: DatasourceItem
775
+ The datasource item to add data quality warnings to.
776
+
777
+ warning: DQWItem
778
+ The data quality warning to add.
779
+
780
+ Returns
781
+ -------
782
+ DQWItem
783
+ The added data quality warning.
784
+
785
+ """
379
786
  return self._data_quality_warnings.add(item, warning)
380
787
 
381
788
  @api(version="3.5")
382
789
  def delete_dqw(self, item):
790
+ """
791
+ Delete a data quality warnings from an asset.
792
+
793
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_metadata.htm#delete_dqws
794
+
795
+ Parameters
796
+ ----------
797
+ item: DatasourceItem
798
+ The datasource item to delete data quality warnings from.
799
+
800
+ Returns
801
+ -------
802
+ None
803
+ """
383
804
  self._data_quality_warnings.clear(item)
384
805
 
385
806
  # Populate datasource item's revisions
386
807
  @api(version="2.3")
387
808
  def populate_revisions(self, datasource_item: DatasourceItem) -> None:
809
+ """
810
+ Retrieve revision information for the specified datasource item.
811
+
812
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#get_data_source_revisions
813
+
814
+ Parameters
815
+ ----------
816
+ datasource_item : DatasourceItem
817
+ The datasource item to retrieve revisions for.
818
+
819
+ Returns
820
+ -------
821
+ None
822
+
823
+ Raises
824
+ ------
825
+ MissingRequiredFieldError
826
+ If the datasource item is missing an ID.
827
+ """
388
828
  if not datasource_item.id:
389
829
  error = "Datasource item missing ID. Datasource must be retrieved from server first."
390
830
  raise MissingRequiredFieldError(error)
@@ -412,6 +852,35 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
412
852
  filepath: Optional[PathOrFileW] = None,
413
853
  include_extract: bool = True,
414
854
  ) -> PathOrFileW:
855
+ """
856
+ Downloads a specific version of a data source prior to the current one
857
+ in .tdsx format. To download the current version of a data source set
858
+ the revision number to None.
859
+
860
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#download_data_source_revision
861
+
862
+ Parameters
863
+ ----------
864
+ datasource_id : str
865
+ The unique ID of the datasource to download.
866
+
867
+ revision_number : Optional[str]
868
+ The revision number of the data source to download. To determine
869
+ what versions are available, call the `populate_revisions` method.
870
+ Pass None to download the current version.
871
+
872
+ filepath : Optional[PathOrFileW]
873
+ The file path to save the downloaded datasource to. If not
874
+ specified, the file will be saved to the current working directory.
875
+
876
+ include_extract : bool, default True
877
+ If True, the extract is included in the download. If False, the
878
+ extract is not included.
879
+
880
+ Returns
881
+ -------
882
+ filepath : PathOrFileW
883
+ """
415
884
  if not datasource_id:
416
885
  error = "Datasource ID undefined."
417
886
  raise ValueError(error)
@@ -445,6 +914,28 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
445
914
 
446
915
  @api(version="2.3")
447
916
  def delete_revision(self, datasource_id: str, revision_number: str) -> None:
917
+ """
918
+ Removes a specific version of a data source from the specified site.
919
+
920
+ The content is removed, and the specified revision can no longer be
921
+ downloaded using Download Data Source Revision. If you call Get Data
922
+ Source Revisions, the revision that's been removed is listed with the
923
+ attribute is_deleted=True.
924
+
925
+ REST API:https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#remove_data_source_revision
926
+
927
+ Parameters
928
+ ----------
929
+ datasource_id : str
930
+ The unique ID of the datasource to delete.
931
+
932
+ revision_number : str
933
+ The revision number of the data source to delete.
934
+
935
+ Returns
936
+ -------
937
+ None
938
+ """
448
939
  if datasource_id is None or revision_number is None:
449
940
  raise ValueError
450
941
  url = "/".join([self.baseurl, datasource_id, "revisions", revision_number])
@@ -457,18 +948,83 @@ class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]
457
948
  def schedule_extract_refresh(
458
949
  self, schedule_id: str, item: DatasourceItem
459
950
  ) -> list["AddResponse"]: # actually should return a task
951
+ """
952
+ Adds a task to refresh a data source to an existing server schedule on
953
+ Tableau Server.
954
+
955
+ 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
956
+
957
+ Parameters
958
+ ----------
959
+ schedule_id : str
960
+ The unique ID of the schedule to add the task to.
961
+
962
+ item : DatasourceItem
963
+ The datasource item to add to the schedule.
964
+
965
+ Returns
966
+ -------
967
+ list[AddResponse]
968
+ """
460
969
  return self.parent_srv.schedules.add_to_schedule(schedule_id, datasource=item)
461
970
 
462
971
  @api(version="1.0")
463
972
  def add_tags(self, item: Union[DatasourceItem, str], tags: Union[Iterable[str], str]) -> set[str]:
973
+ """
974
+ Adds one or more tags to the specified datasource item.
975
+
976
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#add_tags_to_data_source
977
+
978
+ Parameters
979
+ ----------
980
+ item : Union[DatasourceItem, str]
981
+ The datasource item or ID to add tags to.
982
+
983
+ tags : Union[Iterable[str], str]
984
+ The tag or tags to add to the datasource item.
985
+
986
+ Returns
987
+ -------
988
+ set[str]
989
+ The updated set of tags on the datasource item.
990
+ """
464
991
  return super().add_tags(item, tags)
465
992
 
466
993
  @api(version="1.0")
467
994
  def delete_tags(self, item: Union[DatasourceItem, str], tags: Union[Iterable[str], str]) -> None:
995
+ """
996
+ Deletes one or more tags from the specified datasource item.
997
+
998
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#delete_tag_from_data_source
999
+
1000
+ Parameters
1001
+ ----------
1002
+ item : Union[DatasourceItem, str]
1003
+ The datasource item or ID to delete tags from.
1004
+
1005
+ tags : Union[Iterable[str], str]
1006
+ The tag or tags to delete from the datasource item.
1007
+
1008
+ Returns
1009
+ -------
1010
+ None
1011
+ """
468
1012
  return super().delete_tags(item, tags)
469
1013
 
470
1014
  @api(version="1.0")
471
1015
  def update_tags(self, item: DatasourceItem) -> None:
1016
+ """
1017
+ Updates the tags on the server to match the specified datasource item.
1018
+
1019
+ Parameters
1020
+ ----------
1021
+ item : DatasourceItem
1022
+ The datasource item to update tags for.
1023
+
1024
+ Returns
1025
+ -------
1026
+ None
1027
+ """
472
1028
  return super().update_tags(item)
473
1029
 
474
1030
  def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[DatasourceItem]: