8000
We read every piece of feedback, and take your input very seriously.
2 parents 1a5efa2 + 71dab33 commit ada7dbcCopy full SHA for ada7dbc
.gitignore
@@ -2,6 +2,7 @@
2
__pycache__/
3
*.py[cod]
4
*$py.class
5
+test.junit.xml
6
7
# C extensions
8
*.so
@@ -145,4 +146,4 @@ $RECYCLE.BIN/
145
146
147
# Documentation
148
docs/_site/
-docs/.jekyll-metadata
149
+docs/.jekyll-metadata
CHANGELOG.md
@@ -1,3 +1,14 @@
1
+## 0.5 (11 Sept 2017)
+
+* Added revision settings to update site (#187)
+* Added support for certified data sources (#189)
+* Added support for include/exclude extract (#203)
+* Added auto-paging for group users (#204)
+* Added ability to add workbooks to a schedule (#206)
+* Added the ability to create nested projects (#208)
9
+* Fixed sort order when using pager (#192)
10
+* Docs Updates and new samples (#196, #199, #200, #201)
11
12
## 0.4.1 (18 April 2017)
13
14
* Fix #177 to remove left in debugging print
CONTRIBUTORS.md
@@ -5,20 +5,22 @@ The following people have contributed to this project to make it possible, and w
## Contributors
* [geordielad](https://github.com/geordielad)
-* [Hugo Stijns)(https://github.com/hugoboos)
+* [Hugo Stijns](https://github.com/hugoboos)
* [kovner](https://github.com/kovner)
* [Talvalin](https://github.com/Talvalin)
* [Chris Toomey](https://github.com/cmtoomey)
* [Vathsala Achar](https://github.com/VathsalaAchar)
* [Graeme Britz](https://github.com/grbritz)
-
+* [Russ Goldin](https://github.com/tagyoureit)
15
+* [William Lang](https://github.com/williamlang)
16
+* [Jim Morris](https://github.com/jimbodriven)
17
18
## Core Team
19
-* [shinchris](https://github.com/shinchris)
-* [lgraber](https://github.com/lgraber)
20
-* [t8y8](https://github.com/t8y8)
21
-* [RussTheAerialist](https://github.com/RussTheAerialist)
+* [Shin Chris](https://github.com/shinchris)
+* [Lee Graber](https://github.com/lgraber)
22
+* [Tyler Doyle](https://github.com/t8y8)
23
+* [Russell Hay](https://github.com/RussTheAerialist)
24
* [Ben Lower](https://github.com/benlower)
25
* [Jared Dominguez](https://github.com/jdomingu)
26
* [Jackson Huang](https://github.com/jz-huang)
LICENSE.versioneer
@@ -0,0 +1,7 @@
+## License
+To make Versioneer easier to embed, all its code is dedicated to the public
+domain. The `_version.py` that it creates is also in the public domain.
+Specifically, both are released under the Creative Commons "Public Domain
+Dedication" license (CC0-1.0), as described in
+https://creativecommons.org/publicdomain/zero/1.0/ .
MANIFEST.in
@@ -1,2 +1,4 @@
include versioneer.py
include tableauserverclient/_version.py
+include LICENSE
+include LICENSE.versioneer
docs/docs/samples.md
@@ -34,6 +34,8 @@ The following list describes the samples available in the repository:
34
35
* `create_group.py`. Create a user group.
36
37
+* `create_project.py`. Create new projects at the top level as well as nested projects.
38
39
* `create_schedules.py`. Create schedules for extract refreshes and subscriptions.
40
41
* `explore_datasource.py`. Queries datasources, selects a datasource, populates connections for the datasource, then updates the datasource.
@@ -54,4 +56,3 @@ The following list describes the samples available in the repository:
54
56
55
57
**Note**: For all of the samples, ensure that your Tableau Server user account has permission to access the resources
58
requested by the samples.
docs/docs/versions.md
@@ -32,7 +32,7 @@ import tableauserverclient as TSC
32
33
server = TSC.Server('http://SERVER_URL')
-server.version = 2.4
+server.version = '2.4'
```
## Supported versions
samples/create_project.py
@@ -0,0 +1,68 @@
+####
+# This script demonstrates how to use the Tableau Server Client
+# to create new projects, both at the root level and how to nest them using
+# parent_id.
+#
+# To run the script, you must have installed Python 2.7.X or 3.3 and later.
+import argparse
+import getpass
+import logging
+import sys
+import tableauserverclient as TSC
+def create_project(server, project_item):
+ try:
+ project_item = server.projects.create(project_item)
+ print('Created a new project called: %s' % project_item.name)
+ return project_item
+ except TSC.ServerResponseError:
+ print('We have already created this project: %s' % project_item.name)
+ sys.exit(1)
27
+def main():
28
+ parser = argparse.ArgumentParser(description='Get all of the refresh tasks available on a server')
29
+ parser.add_argument('--server', '-s', required=True, help='server address')
30
+ parser.add_argument('--username', '-u', required=True, help='username to sign into server')
31
+ parser.add_argument('--site', '-S', default=None)
+ parser.add_argument('-p', default=None, help='password')
+ parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
+ help='desired logging level (set to error by default)')
+ args = parser.parse_args()
+ if args.p is None:
+ password = getpass.getpass("Password: ")
+ else:
42
+ password = args.p
43
44
+ # Set logging level based on user input, or error by default
45
+ logging_level = getattr(logging, args.logging_level.upper())
46
+ logging.basicConfig(level=logging_level)
47
48
+ tableau_auth = TSC.TableauAuth(args.username, password)
49
+ server = TSC.Server(args.server)
50
51
+ with server.auth.sign_in(tableau_auth):
52
+ # Use highest Server REST API version available
53
+ server.use_server_version()
+ # Without parent_id specified, projects are created at the top level.
+ top_level_project = TSC.ProjectItem(name='Top Level Project')
+ top_level_project = create_project(server, top_level_project)
59
+ # Specifying parent_id creates a nested projects.
60
+ child_project = TSC.ProjectItem(name='Child Project', parent_id=top_level_project.id)
61
+ child_project = create_project(server, child_project)
62
63
+ # Projects can be nested at any level.
64
+ grand_child_project = TSC.ProjectItem(name='Grand Child Project', parent_id=child_project.id)
65
+ grand_child_project = create_project(server, grand_child_project)
66
67
+if __name__ == '__main__':
68
+ main()
samples/filter_sort_groups.py
@@ -0,0 +1,91 @@
+# This script demonstrates how to filter groups using the Tableau
+# Server Client.
+# To run the script, you must have installed Python 2.7.9 or later.
+def create_example_group(group_name='Example Group', server=None):
+ new_group = TSC.GroupItem(group_name)
+ new_group = server.groups.create(new_group)
+ print('Created a new project called: \'%s\'' % group_name)
+ print(new_group)
+ print('Group \'%s\' already existed' % group_name)
+ parser = argparse.ArgumentParser(description='Filter on groups')
+ parser.add_argument('-p', default=None)
+ # Determine and use the highest api version for the server
+ group_name = 'SALES NORTHWEST'
+ # Try to create a group named "SALES NORTHWEST"
+ create_example_group(group_name, server)
+ group_name = 'SALES ROMANIA'
+ # Try to create a group named "SALES ROMANIA"
+ # URL Encode the name of the group that we want to filter on
+ # i.e. turn spaces into plus signs
+ filter_group_name = 'SALES+ROMANIA'
+ options = TSC.RequestOptions()
+ options.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name,
+ TSC.RequestOptions.Operator.Equals,
+ filter_group_name))
+ filtered_groups, _ = server.groups.get(req_options=options)
69
+ # Result can either be a matching group or an empty list
70
+ if filtered_groups:
71
+ group_name = filtered_groups.pop().name
72
+ print(group_name)
73
74
+ error = "No project named '{}' found".format(filter_group_name)
75
+ print(error)
76
77
78
79
+ TSC.RequestOptions.Operator.In,
80
+ ['SALES+NORTHWEST', 'SALES+ROMANIA', 'this_group']))
81
82
+ options.sort.add(TSC.Sort(TSC.RequestOptions.Field.Name,
83
+ TSC.RequestOptions.Direction.Desc))
84
85
+ matching_groups, pagination_item = server.groups.get(req_options=options)
86
+ print('Filtered groups are:')
87
+ for group in matching_groups:
88
+ print(group.name)
89
90
91
samples/filter_sort_projects.py
@@ -0,0 +1,94 @@
+# to filter and sort on the name of the projects present on site.
+def create_example_project(name='Example Project', content_permissions='LockedToProject',
+ description='Project created for testing', server=None):
+ new_project = TSC.ProjectItem(name=name, content_permissions=content_permissions,
+ description=description)
+ server.projects.create(new_project)
+ print('Created a new project called: %s' % name)
+ print('We have already created this resource: %s' % name)
+ filter_project_name = 'default'
+ filter_project_name))
+ filtered_projects, _ = server.projects.get(req_options=options)
+ # Result can either be a matching project or an empty list
+ if filtered_projects:
+ project_name = filtered_projects.pop().name
+ print(project_name)
+ error = "No project named '{}' found".format(filter_project_name)
+ create_example_project(name='Example 1', server=server)
+ create_example_project(name='Example 2', server=server)
+ create_example_project(name='Example 3', server=server)
+ create_example_project(name='Proiect ca Exemplu', server=server)
+ # don't forget to URL encode the query names
+ ['Example+1', 'Example+2', 'Example+3']))
+ matching_projects, pagination_item = server.projects.get(req_options=options)
+ print('Filtered projects are:')
+ for project in matching_projects:
+ print(project.name, project.id)
92
93
94