Skip to content

Commit 9ae7d3c

Browse files
authored
Update & Extend documentation (#1078)
* update/fix some documentation aspects * provide documentation for `schedules.add_to_schedule()`
1 parent 69737ee commit 9ae7d3c

1 file changed

Lines changed: 62 additions & 14 deletions

File tree

docs/api-ref.md

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,8 @@ The `ConnectionCredentials` class is used for workbook and data source publish r
256256
Attribute | Description
257257
:--- | :---
258258
`name` | The username for the connection.
259-
`embed_password` | (Boolean) Determines whether to embed the password (`True`) for the workbook or data source connection or not (`False`).
259+
`embed` | (Boolean) Determines whether to embed the password (`True`) for the workbook or data source connection or not (`False`).
260260
`password` | The password used for the connection.
261-
`server_address` | The server address for the connection.
262-
`server_port` | The port used by the server.
263261
`ouath` | (Boolean) Specifies whether OAuth is used for the data source of workbook connection. For more information, see [OAuth Connections](https://help.tableau.com/current/server/en-us/protected_auth.htm).
264262

265263

@@ -562,7 +560,7 @@ None. A list of `ConnectionItem` objects are added to the data source (`datasour
562560
#### datasources.publish
563561

564562
```py
565-
datasources.publish(datasource_item, file_path, mode, connection_credentials=None)
563+
datasources.publish(datasource_item, file, mode, connection_credentials=None, as_job=False)
566564
```
567565

568566
Publishes a data source to a server, or appends data to an existing data source.
@@ -576,9 +574,10 @@ REST API: [Publish Datasource](https://help.tableau.com/current/api/rest_api/en-
576574
Name | Description
577575
:--- | :---
578576
`datasource_item` | The `datasource_item` specifies the new data source you are adding, or the data source you are appending to. If you are adding a new data source, you need to create a new `datasource_item` with a `project_id` of an existing project. The name of the data source will be the name of the file, unless you also specify a name for the new data source when you create the instance. See [DatasourceItem](#datasourceitem-class).
579-
`file_path` | The path and name of the data source to publish.
577+
`file` | The file path or file object of the data source to publish.
580578
`mode` | Specifies whether you are publishing a new data source (`CreateNew`), overwriting an existing data source (`Overwrite`), or appending data to a data source (`Append`). If you are appending to a data source, the data source on the server and the data source you are publishing must be be extracts (.tde files) and they must share the same schema. You can also use the publish mode attributes, for example: `TSC.Server.PublishMode.Overwrite`.
581579
`connection_credentials` | (Optional) The credentials required to connect to the data source. The `ConnectionCredentials` object contains the authentication information for the data source (user name and password, and whether the credentials are embedded or OAuth is used).
580+
`as_job` | (Optional) If this value is set to `True`, the publish operation will be asynchronous and return a JobItem.
582581

583582

584583

@@ -2655,7 +2654,7 @@ Source file: models/schedule_item.py
26552654
Name | Description
26562655
:--- | :---
26572656
`name` | The `name` of the schedule.
2658-
`id` | The identifier for the schedule. Use the `schedules.get()` method to get the identifiers of the schedules on the server.
2657+
`priority` | The priority of the schedule (integer). Lower values represent higher priorities, with `0` indicating the highest priority.
26592658
`schedule_type` | The type of task. The types are either an `Extract` for an extract refresh task or a `Subscription` for a scheduled subscription.
26602659
`execution_order` | Specifies how the scheduled task should run. The choices are `Parallel`which uses all available background processes for this scheduled task, or `Serial`, which limits this schedule to one background process.
26612660
`interval_item` | Specifies the frequency that the scheduled task should run. The `interval_item` is an instance of the `IntervalItem` class. The `interval_item` has properties for frequency (hourly, daily, weekly, monthly), and what time and date the scheduled item runs. You set this value by declaring an `IntervalItem` object that is one of the following: `HourlyInterval`, `DailyInterval`, `WeeklyInterval`, or `MonthlyInterval`.
@@ -2683,10 +2682,59 @@ The schedule methods are based upon the endpoints for schedules in the REST API
26832682

26842683
Source files: server/endpoint/schedules_endpoint.py
26852684

2686-
#### schedule.create
2685+
#### schedules.add_to_schedule
2686+
2687+
```py
2688+
schedules.add_to_schedule(schedule_id, workbook=None, datasource=None, flow=None, task_type=None)
2689+
```
2690+
2691+
Adds a `DatasourceItem`, `FlowItem`, or `WorkbookItem` to a schedule.
2692+
2693+
2694+
REST API: [Add Data Source to Schedule](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#add_data_source_to_schedule)
2695+
2696+
2697+
2698+
**Parameters**
2699+
2700+
Name | Description
2701+
:--- | :---
2702+
`schedule_id` | The identifier (id) of the schedule to add the data source or workbook to. Can be retrieved from a `ScheduleItem`, e.g., by performing `schedules.get()`.
2703+
`workbook` | (Optional) A `WorkbookItem` that should be added to the schedule. Only provide either `workbook` or `datasource`, passing multiple items will be deprecated.
2704+
`datasource` | (Optional) A `DatasourceItem` that should be added to the schedule. Only provide either `workbook` or `datasource`, passing multiple items will be deprecated.
2705+
`flow` | (Optional) A `FlowItem` that should be added to the schedule. Only applicable if `workbook = None` and `datasource = None`.
2706+
`task_type` | (Optional) Determines the type of task. One of `TaskItem.Type`: `ExtractRefresh`, `DataAcceleration`, `RunFlow`.
2707+
2708+
2709+
**Returns**
2710+
Returns a List of `AddResponses`.
2711+
2712+
2713+
**Example**
2714+
2715+
```py
2716+
import tableauserverclient as TSC
2717+
# sign in, etc.
2718+
# get a datasource item that should be added to a schedule
2719+
datasource_item = server.datasources.get("d14dd951-01c1-4879-8bc2-e96d7dec9f0")
2720+
2721+
# retrieve the id of the target schedule
2722+
schedule_id = schedule_item.id # can be a freshly created schedule or one queried via `schedules.get()`
2723+
2724+
# Add the data source to the schedule
2725+
server.schedules.add_to_schedule(
2726+
schedule_id=schedule_id,
2727+
datasource=datasource_item,
2728+
)
2729+
```
2730+
<br>
2731+
<br>
2732+
2733+
2734+
#### schedules.create
26872735

26882736
```py
2689-
schedule.create(schedule_item)
2737+
schedules.create(schedule_item)
26902738
```
26912739
Creates a new schedule for an extract refresh or a subscription.
26922740

@@ -2731,10 +2779,10 @@ import tableauserverclient as TSC
27312779
<br>
27322780

27332781

2734-
#### schedule.delete
2782+
#### schedules.delete
27352783

27362784
```py
2737-
schedule.delete(schedule_id)
2785+
schedules.delete(schedule_id)
27382786
```
27392787

27402788
Deletes an existing schedule for an extract refresh or a subscription.
@@ -2762,10 +2810,10 @@ Error | Description
27622810
`Schedule ID undefined` | The identifier is not a valid identifier for a schedule on the server.
27632811

27642812

2765-
#### schedule.get
2813+
#### schedules.get
27662814

27672815
```py
2768-
schedule.get([req_options=None])
2816+
schedules.get([req_options=None])
27692817
```
27702818

27712819
Returns all schedule items from the server.
@@ -2781,7 +2829,7 @@ Name | Description
27812829
:--- | :---
27822830
`req_options` | (Optional) Additional request options to send to the endpoint.
27832831

2784-
#### schedule.update
2832+
#### schedules.update
27852833

27862834
<br>
27872835
<br>
@@ -5100,7 +5148,7 @@ Name | Description
51005148
`workbook_item` | The `workbook_item` specifies the workbook you are publishing. When you are adding a workbook, you need to first create a new instance of a `workbook_item` that includes a `project_id` of an existing project. The name of the workbook will be the name of the file, unless you also specify a name for the new workbook when you create the instance. See [WorkbookItem](#workbookitem-class).
51015149
`file_path` | The path and name of the workbook to publish.
51025150
`mode` | Specifies whether you are publishing a new workbook (`CreateNew`) or overwriting an existing workbook (`Overwrite`). You cannot appending workbooks. You can also use the publish mode attributes, for example: `TSC.Server.PublishMode.Overwrite`.
5103-
`connections` | List of `ConnectionCredentials` objects for the connections created within the workbook.
5151+
`connections` | List of `ConnectionItems` objects for the connections created within the workbook.
51045152
`connection_credentials` | (Optional) The credentials (if required) to connect to the workbook's data source. The `ConnectionCredentials` object contains the authentication information for the data source (user name and password, and whether the credentials are embedded or OAuth is used). **Deprecated since API server version 2.3.**
51055153
`skip_connection_check` | (Optional) Set to `True` to skip connection check at time of upload. Publishing will succeed but unchecked connection issues may result in a non-functioning workbook. Defaults to `False`.
51065154
`as_job` | (Optional) Set to `True` to run the upload as a job (asynchronous upload). If set to `True` a job will start to perform the publishing process and a `Job` object is returned. Defaults to `False`.

0 commit comments

Comments
 (0)