Skip to content

Commit f634580

Browse files
committed
Squashed commit of the following:
commit ed940a2 Author: Jac <[email protected]> Date: Thu Jan 27 20:16:31 2022 -0800 make tests run even if code style fails (tableau#980) commit fb49f31 Author: jorwoods <[email protected]> Date: Thu Jan 27 21:54:31 2022 -0600 Jorwoods/type hint flows (tableau#937) * Type hint Flows * Type hint request_factory for flows * Add ConnectionItem type hints on to Flow publish request * Clean up flows publish signature * Fix flow update_permissions type hint * Fix update_permissions type hint * Add workbook.hidden_views type hint * Update permissions only accepts an iterable * Fix formatting commit f40d4bc Author: jorwoods <[email protected]> Date: Thu Jan 27 21:47:53 2022 -0600 Jorwoods/type hint favorites (tableau#936) * Type hint Favorites * Type hint FavoriteRequest commit 4d0142d Author: jorwoods <[email protected]> Date: Thu Jan 27 21:45:14 2022 -0600 Jorwoods/type hint data alert (tableau#934) * Type hint data alerts * Type hint DataAlertRequest * Remove type annotations from Frequency namespace * Update test_dataalert.py commit b836f33 Author: Brian Cantoni <[email protected]> Date: Thu Jan 27 19:29:50 2022 -0800 WIP: Enable Black for CI and add as dependency (tableau#935) * Enable Black for CI and add as dependency * Bulk reformat with Black, line length 120 Co-authored-by: Jac Fitzgerald <[email protected]> commit ad57851 Author: jorwoods <[email protected]> Date: Thu Nov 11 15:55:01 2021 -0600 Jorwoods/type hint revisions (tableau#956) Add type hints and tests for workbook and data source revisions commit bb0feb8 Author: elsherif <[email protected]> Date: Wed Nov 10 01:21:16 2021 +0100 Add support to datasource and workbook revisions (tableau#931) * add support to datasource and workbook revisions (get all item revisions / downlad item by revision number) * add type hints * remove wrong type hints commit 31d420f Author: Stephen Mitchell <[email protected]> Date: Tue Nov 9 01:02:14 2021 -0500 Clean up hidden_views by making it an attribute of WorkbookItem (tableau#617) * Clean up hidden views and make it an attribute of workbookitem * Pycodestyle error fix for one letter variable Co-authored-by: Jac <[email protected]> Co-authored by: Stephen Mitchell https://github.com/scuml commit 7443f68 Author: jorwoods <[email protected]> Date: Sun Nov 7 05:57:42 2021 -0600 Add type hints to `Job` (tableau#939) commit c8170ae Author: Tyler Doyle <[email protected]> Date: Mon Nov 1 20:36:17 2021 -0400 Fix slack once and for all (tableau#946) The red X keeps coming back so I'd like to mark this as allowably fail-able -- that way the innards of Slack/OAuth/Tableau credentials don't keep polluting test run reports :) commit 946469c Author: jorwoods <[email protected]> Date: Mon Nov 1 14:33:22 2021 -0500 Type hinting on Datasources and Workbooks (tableau#804) Adds types to function signatures for Workbook and Data Source endpoints. Co-authored-by: Jordan Woods <[email protected]> commit feed39c Author: Brian Cantoni <[email protected]> Date: Tue Oct 26 08:04:10 2021 -0700 Switch to release Python 3.10 release for CI (tableau#927) * Switch to release Python 3.10 release for CI commit 4007d3d Author: Jac <[email protected]> Date: Fri Oct 22 19:06:20 2021 -0700 Jac/publish samples (tableau#918) * add publish-samples option to create/update project commit a899a95 Author: mmuttreja-tableau <[email protected]> Date: Thu Oct 21 12:10:37 2021 -0400 Adjusting changelog to include missing updates for release 0.17 (tableau#922) commit f81039a Merge: fefd6f1 46bbe2e Author: mmuttreja-tableau <[email protected]> Date: Wed Oct 20 17:43:50 2021 -0400 Merge pull request tableau#921 from tableau/development Merging Development to Main branch for releasing v 0.17 commit 46bbe2e Author: mmuttreja-tableau <[email protected]> Date: Wed Oct 20 17:26:45 2021 -0400 Update contributors and Changelog for Release 0.17 (tableau#920) * Update CONTRIBUTORS.md & changelog for v 0.17 Update contributors & changelog for v 0.17 commit 428eb55 Author: jorwoods <[email protected]> Date: Tue Oct 19 12:32:51 2021 -0500 Add FlowRun Item and Endpoints. (tableau#884) * Add tests for fetching flow runs * Implement basics of FlowRuns * Add tests for cancel flow run * Make FlowRuns a Queryset endpoint for easier filtering * Add test for flow refresh endpoint * Align to naming conventions * Apply name change consistently * Change flowrun_id into flow_run_id * Add wait_for_job to FlowRun * Tag wait_for_job with version number * Rewrite flow_run to use ExponentialBackoffTimer * Test flow run wait with backoff * Remove 3.5 from test matrix * Standardize spelling of cancelled Co-authored-by: Jordan Woods <[email protected]> commit fefd6f1 Merge: 1d8a9be 0845b7b Author: Jac <[email protected]> Date: Thu Sep 2 17:49:07 2021 -0700 Merge pull request tableau#880 from tableau/upgrade-slack-action Upgrade to newer Slack action provider commit 0845b7b Author: Brian Cantoni <[email protected]> Date: Wed Sep 1 14:22:53 2021 -0700 Upgrade to newer Slack action provider commit 1d8a9be Merge: 5cbfc34 770d48a Author: Ovini Nanayakkara <[email protected]> Date: Fri Jul 16 12:42:30 2021 -0400 Merge pull request tableau#864 from tableau/development Merging Development to Main branch commit 5cbfc34 Merge: ec3cc50 ffefd80 Author: Jac <[email protected]> Date: Wed Jun 23 23:33:47 2021 -0700 Merge pull request tableau#851 from tableau/jacalata-patch-1 Create slack.yml action commit ffefd80 Author: Jac <[email protected]> Date: Mon May 24 13:34:07 2021 -0700 whitespace change to re-try PR commit 0c4fd4a Author: Jac <[email protected]> Date: Mon May 24 13:15:49 2021 -0700 Create slack.yml Created a new action from https://github.com/marketplace/actions/send-message-to-slack
1 parent c56edf7 commit f634580

File tree

101 files changed

+4192
-2866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+4192
-2866
lines changed

.github/workflows/run-tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
fail-fast: false
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0-rc.2]
11+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
1212

1313
runs-on: ${{ matrix.os }}
1414

@@ -25,10 +25,16 @@ jobs:
2525
python -m pip install --upgrade pip
2626
pip install -e .[test]
2727
28+
- name: Format with black
29+
run: |
30+
black --check --line-length 120 tableauserverclient samples test
31+
2832
- name: Test with pytest
33+
if: always()
2934
run: |
3035
pytest test
3136
3237
- name: Run Mypy tests
38+
if: always()
3339
run: |
3440
mypy --show-error-codes --disable-error-code misc --disable-error-code import tableauserverclient test

.github/workflows/slack.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 💬 Send Message to Slack 🚀
2+
3+
on: [push, pull_request, issues]
4+
5+
jobs:
6+
slack-notifications:
7+
continue-on-error: true
8+
runs-on: ubuntu-20.04
9+
name: Sends a message to Slack when a push, a pull request or an issue is made
10+
steps:
11+
- name: Send message to Slack API
12+
continue-on-error: true
13+
uses: archive/[email protected]
14+
id: notify
15+
with:
16+
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
17+
slack-channel: C019HCX84L9
18+
slack-text: Hello! Event "${{ github.event_name }}" in "${{ github.repository }}" 🤓
19+
- name: Result from "Send Message"
20+
run: echo "The result was ${{ steps.notify.outputs.slack-result }}"

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## 0.17.0 (20 October 2021)
2+
* Added support for accepting parameters for post request of the metadata api (#850)
3+
* Fixed jobs.get_by_id(job_id) example & reference docs (#867, #868)
4+
* Fixed handling for workbooks in personal spaces which do not have projectID or Name (#875)
5+
* Updated links to Data Source Methods page in REST API docs (#879)
6+
* Unified arguments of sample scripts (#889)
7+
* Updated docs for - links to Datasource API (#879) , sample scripts (#892) & metadata query (#896)
8+
* Added support for scheduling DataUpdate Jobs (#891)
9+
* Exposed the fileuploads API endpoint (#894)
10+
* Added a new sample & documentation for metadata API (#895, #896)
11+
* Added support to the package for getting flow run status, as well as the ability to cancel flow runs. (#884)
12+
* Added jobs.wait_for_job method (#903)
13+
* Added description support for datasources item (#912)
14+
* Dropped support for Python 3.5 (#911)
15+
116
## 0.16.0 (15 July 2021)
217
* Documentation updates (#800, #818, #839, #842)
318
* Fixed data alert repr in subscription item (#821)

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ The following people have contributed to this project to make it possible, and w
5959
* [Dan Zucker](https://github.com/dzucker-tab)
6060
* [Brian Cantoni](https://github.com/bcantoni)
6161
* [Ovini Nanayakkara](https://github.com/ovinis)
62+
* [Manish Muttreja](https://github.com/mmuttreja-tableau)

contributing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ python setup.py build
6262
python setup.py test
6363
```
6464

65+
### To use your locally built version
66+
```shell
67+
pip install .
68+
```
69+
6570
### Before Committing
6671

6772
Our CI runs include a Python lint run, so you should run this locally and fix complaints before committing as this will fail your checkin.

samples/add_default_permission.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,23 @@
1616

1717

1818
def main():
19-
parser = argparse.ArgumentParser(description='Add workbook default permissions for a given project.')
19+
parser = argparse.ArgumentParser(description="Add workbook default permissions for a given project.")
2020
# Common options; please keep those in sync across all samples
21-
parser.add_argument('--server', '-s', required=True, help='server address')
22-
parser.add_argument('--site', '-S', help='site name')
23-
parser.add_argument('--token-name', '-p', required=True,
24-
help='name of the personal access token used to sign into the server')
25-
parser.add_argument('--token-value', '-v', required=True,
26-
help='value of the personal access token used to sign into the server')
27-
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
28-
help='desired logging level (set to error by default)')
21+
parser.add_argument("--server", "-s", required=True, help="server address")
22+
parser.add_argument("--site", "-S", help="site name")
23+
parser.add_argument(
24+
"--token-name", "-p", required=True, help="name of the personal access token used to sign into the server"
25+
)
26+
parser.add_argument(
27+
"--token-value", "-v", required=True, help="value of the personal access token used to sign into the server"
28+
)
29+
parser.add_argument(
30+
"--logging-level",
31+
"-l",
32+
choices=["debug", "info", "error"],
33+
default="error",
34+
help="desired logging level (set to error by default)",
35+
)
2936
# Options specific to this sample
3037
# This sample has no additional options, yet. If you add some, please add them here
3138

@@ -53,10 +60,7 @@ def main():
5360
new_capabilities = {TSC.Permission.Capability.ExportXml: TSC.Permission.Mode.Allow}
5461

5562
# Each PermissionRule in the list contains a grantee and a dict of capabilities
56-
new_rules = [TSC.PermissionsRule(
57-
grantee=default_permissions.grantee,
58-
capabilities=new_capabilities
59-
)]
63+
new_rules = [TSC.PermissionsRule(grantee=default_permissions.grantee, capabilities=new_capabilities)]
6064

6165
new_default_permissions = server.projects.update_workbook_default_permissions(project, new_rules)
6266

@@ -78,5 +82,5 @@ def main():
7882
# server.projects.delete(project.id)
7983

8084

81-
if __name__ == '__main__':
85+
if __name__ == "__main__":
8286
main()

samples/create_group.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,23 @@
1616

1717
def main():
1818

19-
parser = argparse.ArgumentParser(description='Creates a sample user group.')
19+
parser = argparse.ArgumentParser(description="Creates a sample user group.")
2020
# Common options; please keep those in sync across all samples
21-
parser.add_argument('--server', '-s', required=True, help='server address')
22-
parser.add_argument('--site', '-S', help='site name')
23-
parser.add_argument('--token-name', '-p', required=True,
24-
help='name of the personal access token used to sign into the server')
25-
parser.add_argument('--token-value', '-v', required=True,
26-
help='value of the personal access token used to sign into the server')
27-
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
28-
help='desired logging level (set to error by default)')
21+
parser.add_argument("--server", "-s", required=True, help="server address")
22+
parser.add_argument("--site", "-S", help="site name")
23+
parser.add_argument(
24+
"--token-name", "-p", required=True, help="name of the personal access token used to sign into the server"
25+
)
26+
parser.add_argument(
27+
"--token-value", "-v", required=True, help="value of the personal access token used to sign into the server"
28+
)
29+
parser.add_argument(
30+
"--logging-level",
31+
"-l",
32+
choices=["debug", "info", "error"],
33+
default="error",
34+
help="desired logging level (set to error by default)",
35+
)
2936
# Options specific to this sample
3037
# This sample has no additional options, yet. If you add some, please add them here
3138

@@ -38,10 +45,10 @@ def main():
3845
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
3946
server = TSC.Server(args.server, use_server_version=True)
4047
with server.auth.sign_in(tableau_auth):
41-
group = TSC.GroupItem('test')
48+
group = TSC.GroupItem("test")
4249
group = server.groups.create(group)
4350
print(group)
4451

4552

46-
if __name__ == '__main__':
53+
if __name__ == "__main__":
4754
main()

samples/create_project.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,34 @@
1414
import tableauserverclient as TSC
1515

1616

17-
def create_project(server, project_item):
17+
def create_project(server, project_item, samples=False):
1818
try:
19-
project_item = server.projects.create(project_item)
20-
print('Created a new project called: %s' % project_item.name)
19+
project_item = server.projects.create(project_item, samples)
20+
print("Created a new project called: %s" % project_item.name)
2121
return project_item
2222
except TSC.ServerResponseError:
23-
print('We have already created this project: %s' % project_item.name)
23+
print("We have already created this project: %s" % project_item.name)
2424
sys.exit(1)
2525

2626

2727
def main():
28-
parser = argparse.ArgumentParser(description='Create new projects.')
28+
parser = argparse.ArgumentParser(description="Create new projects.")
2929
# Common options; please keep those in sync across all samples
30-
parser.add_argument('--server', '-s', required=True, help='server address')
31-
parser.add_argument('--site', '-S', help='site name')
32-
parser.add_argument('--token-name', '-p', required=True,
33-
help='name of the personal access token used to sign into the server')
34-
parser.add_argument('--token-value', '-v', required=True,
35-
help='value of the personal access token used to sign into the server')
36-
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
37-
help='desired logging level (set to error by default)')
30+
parser.add_argument("--server", "-s", required=True, help="server address")
31+
parser.add_argument("--site", "-S", help="site name")
32+
parser.add_argument(
33+
"--token-name", "-p", required=True, help="name of the personal access token used to sign into the server"
34+
)
35+
parser.add_argument(
36+
"--token-value", "-v", required=True, help="value of the personal access token used to sign into the server"
37+
)
38+
parser.add_argument(
39+
"--logging-level",
40+
"-l",
41+
choices=["debug", "info", "error"],
42+
default="error",
43+
help="desired logging level (set to error by default)",
44+
)
3845
# Options specific to this sample
3946
# This sample has no additional options, yet. If you add some, please add them here
4047

@@ -45,23 +52,27 @@ def main():
4552
logging.basicConfig(level=logging_level)
4653

4754
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
48-
server = TSC.Server(args.server, use_server_version=True)
55+
server = TSC.Server(args.server)
56+
server.use_server_version()
4957
with server.auth.sign_in(tableau_auth):
5058
# Use highest Server REST API version available
5159
server.use_server_version()
5260

5361
# Without parent_id specified, projects are created at the top level.
54-
top_level_project = TSC.ProjectItem(name='Top Level Project')
62+
top_level_project = TSC.ProjectItem(name="Top Level Project")
5563
top_level_project = create_project(server, top_level_project)
5664

5765
# Specifying parent_id creates a nested projects.
58-
child_project = TSC.ProjectItem(name='Child Project', parent_id=top_level_project.id)
59-
child_project = create_project(server, child_project)
66+
child_project = TSC.ProjectItem(name="Child Project", parent_id=top_level_project.id)
67+
child_project = create_project(server, child_project, samples=True)
6068

6169
# Projects can be nested at any level.
62-
grand_child_project = TSC.ProjectItem(name='Grand Child Project', parent_id=child_project.id)
70+
grand_child_project = TSC.ProjectItem(name="Grand Child Project", parent_id=child_project.id)
6371
grand_child_project = create_project(server, grand_child_project)
6472

73+
# Projects can be updated
74+
changed_project = server.projects.update(grand_child_project, samples=True)
6575

66-
if __name__ == '__main__':
76+
77+
if __name__ == "__main__":
6778
main()

samples/create_schedules.py

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,23 @@
1616

1717
def main():
1818

19-
parser = argparse.ArgumentParser(description='Creates sample schedules for each type of frequency.')
19+
parser = argparse.ArgumentParser(description="Creates sample schedules for each type of frequency.")
2020
# Common options; please keep those in sync across all samples
21-
parser.add_argument('--server', '-s', required=True, help='server address')
22-
parser.add_argument('--site', '-S', help='site name')
23-
parser.add_argument('--token-name', '-p', required=True,
24-
help='name of the personal access token used to sign into the server')
25-
parser.add_argument('--token-value', '-v', required=True,
26-
help='value of the personal access token used to sign into the server')
27-
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
28-
help='desired logging level (set to error by default)')
21+
parser.add_argument("--server", "-s", required=True, help="server address")
22+
parser.add_argument("--site", "-S", help="site name")
23+
parser.add_argument(
24+
"--token-name", "-p", required=True, help="name of the personal access token used to sign into the server"
25+
)
26+
parser.add_argument(
27+
"--token-value", "-v", required=True, help="value of the personal access token used to sign into the server"
28+
)
29+
parser.add_argument(
30+
"--logging-level",
31+
"-l",
32+
choices=["debug", "info", "error"],
33+
default="error",
34+
help="desired logging level (set to error by default)",
35+
)
2936
# Options specific to this sample
3037
# This sample has no additional options, yet. If you add some, please add them here
3138

@@ -40,43 +47,59 @@ def main():
4047
with server.auth.sign_in(tableau_auth):
4148
# Hourly Schedule
4249
# This schedule will run every 2 hours between 2:30AM and 11:00PM
43-
hourly_interval = TSC.HourlyInterval(start_time=time(2, 30),
44-
end_time=time(23, 0),
45-
interval_value=2)
46-
47-
hourly_schedule = TSC.ScheduleItem("Hourly-Schedule", 50, TSC.ScheduleItem.Type.Extract,
48-
TSC.ScheduleItem.ExecutionOrder.Parallel, hourly_interval)
50+
hourly_interval = TSC.HourlyInterval(start_time=time(2, 30), end_time=time(23, 0), interval_value=2)
51+
52+
hourly_schedule = TSC.ScheduleItem(
53+
"Hourly-Schedule",
54+
50,
55+
TSC.ScheduleItem.Type.Extract,
56+
TSC.ScheduleItem.ExecutionOrder.Parallel,
57+
hourly_interval,
58+
)
4959
hourly_schedule = server.schedules.create(hourly_schedule)
5060
print("Hourly schedule created (ID: {}).".format(hourly_schedule.id))
5161

5262
# Daily Schedule
5363
# This schedule will run every day at 5AM
5464
daily_interval = TSC.DailyInterval(start_time=time(5))
55-
daily_schedule = TSC.ScheduleItem("Daily-Schedule", 60, TSC.ScheduleItem.Type.Subscription,
56-
TSC.ScheduleItem.ExecutionOrder.Serial, daily_interval)
65+
daily_schedule = TSC.ScheduleItem(
66+
"Daily-Schedule",
67+
60,
68+
TSC.ScheduleItem.Type.Subscription,
69+
TSC.ScheduleItem.ExecutionOrder.Serial,
70+
daily_interval,
71+
)
5772
daily_schedule = server.schedules.create(daily_schedule)
5873
print("Daily schedule created (ID: {}).".format(daily_schedule.id))
5974

6075
# Weekly Schedule
6176
# This schedule will wun every Monday, Wednesday, and Friday at 7:15PM
62-
weekly_interval = TSC.WeeklyInterval(time(19, 15),
63-
TSC.IntervalItem.Day.Monday,
64-
TSC.IntervalItem.Day.Wednesday,
65-
TSC.IntervalItem.Day.Friday)
66-
weekly_schedule = TSC.ScheduleItem("Weekly-Schedule", 70, TSC.ScheduleItem.Type.Extract,
67-
TSC.ScheduleItem.ExecutionOrder.Serial, weekly_interval)
77+
weekly_interval = TSC.WeeklyInterval(
78+
time(19, 15), TSC.IntervalItem.Day.Monday, TSC.IntervalItem.Day.Wednesday, TSC.IntervalItem.Day.Friday
79+
)
80+
weekly_schedule = TSC.ScheduleItem(
81+
"Weekly-Schedule",
82+
70,
83+
TSC.ScheduleItem.Type.Extract,
84+
TSC.ScheduleItem.ExecutionOrder.Serial,
85+
weekly_interval,
86+
)
6887
weekly_schedule = server.schedules.create(weekly_schedule)
6988
print("Weekly schedule created (ID: {}).".format(weekly_schedule.id))
7089

7190
# Monthly Schedule
7291
# This schedule will run on the 15th of every month at 11:30PM
73-
monthly_interval = TSC.MonthlyInterval(start_time=time(23, 30),
74-
interval_value=15)
75-
monthly_schedule = TSC.ScheduleItem("Monthly-Schedule", 80, TSC.ScheduleItem.Type.Subscription,
76-
TSC.ScheduleItem.ExecutionOrder.Parallel, monthly_interval)
92+
monthly_interval = TSC.MonthlyInterval(start_time=time(23, 30), interval_value=15)
93+
monthly_schedule = TSC.ScheduleItem(
94+
"Monthly-Schedule",
95+
80,
96+
TSC.ScheduleItem.Type.Subscription,
97+
TSC.ScheduleItem.ExecutionOrder.Parallel,
98+
monthly_interval,
99+
)
77100
monthly_schedule = server.schedules.create(monthly_schedule)
78101
print("Monthly schedule created (ID: {}).".format(monthly_schedule.id))
79102

80103

81-
if __name__ == '__main__':
104+
if __name__ == "__main__":
82105
main()

0 commit comments

Comments
 (0)