Skip to content

Commit

Permalink
Merge pull request #921 from tableau/development
Browse files Browse the repository at this point in the history
Merging Development to Main branch for releasing v 0.17
  • Loading branch information
mmuttreja-tableau authored Oct 20, 2021
2 parents fefd6f1 + 46bbe2e commit f81039a
Show file tree
Hide file tree
Showing 76 changed files with 1,360 additions and 424 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: Python package
name: Python tests

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0-rc.2]

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

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.17.0 (20 October 2021)
Update publish.sh to use python3 (#866)
Fixed jobs.get_by_id(job_id) example & reference docs (#867, #868)
Fixed handling for workbooks in personal spaces which do not have projectID or Name (#875)
Updated links to Data Source Methods page in REST API docs (#879)
Upgraded to newer Slack action provider (#880)
Added support to the package for getting flow run status, as well as the ability to cancel flow runs. (#884)

## 0.16.0 (15 July 2021)
* Documentation updates (#800, #818, #839, #842)
* Fixed data alert repr in subscription item (#821)
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ The following people have contributed to this project to make it possible, and w
* [Dan Zucker](https://github.com/dzucker-tab)
* [Brian Cantoni](https://github.com/bcantoni)
* [Ovini Nanayakkara](https://github.com/ovinis)
* [Manish Muttreja](https://github.com/mmuttreja-tableau)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Use the Tableau Server Client (TSC) library to increase your productivity as you
* Create users and groups.
* Query projects, sites, and more.

This repository contains Python source code and sample files. Python versions 3.5 and up are supported.
This repository contains Python source code and sample files. Python versions 3.6 and up are supported.

For more information on installing and using TSC, see the documentation:
<https://tableau.github.io/server-client-python/docs/>
Expand Down
3 changes: 1 addition & 2 deletions publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -e

rm -rf dist
python setup.py sdist
python setup.py bdist_wheel
python3 setup.py sdist
python3 setup.py bdist_wheel
twine upload dist/*
26 changes: 12 additions & 14 deletions samples/add_default_permission.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
####
# This script demonstrates how to add default permissions using TSC
# To run the script, you must have installed Python 3.5 and later.
# To run the script, you must have installed Python 3.6 or later.
#
# In order to demonstrate adding a new default permission, this sample will create
# a new project and add a new capability to the new project, for the default "All users" group.
Expand All @@ -10,35 +10,33 @@
####

import argparse
import getpass
import logging

import tableauserverclient as TSC


def main():
parser = argparse.ArgumentParser(description='Add workbook default permissions for a given project.')
parser.add_argument('--server', '-s', required=True, help='Server address')
parser.add_argument('--username', '-u', required=True, help='Username to sign into server')
parser.add_argument('--site', '-S', default=None, help='Site to sign into - default site if not provided')
parser.add_argument('-p', default=None, help='Password to sign into server')

# Common options; please keep those in sync across all samples
parser.add_argument('--server', '-s', required=True, help='server address')
parser.add_argument('--site', '-S', help='site name')
parser.add_argument('--token-name', '-p', required=True,
help='name of the personal access token used to sign into the server')
parser.add_argument('--token-value', '-v', required=True,
help='value of the personal access token used to sign into the server')
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
help='desired logging level (set to error by default)')
# Options specific to this sample
# This sample has no additional options, yet. If you add some, please add them here

args = parser.parse_args()

if args.p is None:
password = getpass.getpass("Password: ")
else:
password = args.p

# Set logging level based on user input, or error by default
logging_level = getattr(logging, args.logging_level.upper())
logging.basicConfig(level=logging_level)

# Sign in
tableau_auth = TSC.TableauAuth(args.username, password, args.site)
# Sign in to server
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
server = TSC.Server(args.server, use_server_version=True)
with server.auth.sign_in(tableau_auth):

Expand Down
19 changes: 12 additions & 7 deletions samples/create_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# This script demonstrates how to create a group using the Tableau
# Server Client.
#
# To run the script, you must have installed Python 3.5 or later.
# To run the script, you must have installed Python 3.6 or later.
####


import argparse
import getpass
import logging

from datetime import time
Expand All @@ -18,20 +17,26 @@
def main():

parser = argparse.ArgumentParser(description='Creates a sample user group.')
# Common options; please keep those in sync across all samples
parser.add_argument('--server', '-s', required=True, help='server address')
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
parser.add_argument('--site', '-S', help='site name')
parser.add_argument('--token-name', '-p', required=True,
help='name of the personal access token used to sign into the server')
parser.add_argument('--token-value', '-v', required=True,
help='value of the personal access token used to sign into the server')
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()
# Options specific to this sample
# This sample has no additional options, yet. If you add some, please add them here

password = getpass.getpass("Password: ")
args = parser.parse_args()

# Set logging level based on user input, or error by default
logging_level = getattr(logging, args.logging_level.upper())
logging.basicConfig(level=logging_level)

tableau_auth = TSC.TableauAuth(args.username, password)
server = TSC.Server(args.server)
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
server = TSC.Server(args.server, use_server_version=True)
with server.auth.sign_in(tableau_auth):
group = TSC.GroupItem('test')
group = server.groups.create(group)
Expand Down
25 changes: 11 additions & 14 deletions samples/create_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
# parent_id.
#
#
# To run the script, you must have installed Python 3.5 or later.
# To run the script, you must have installed Python 3.6 or later.
####

import argparse
import getpass
import logging
import sys

Expand All @@ -27,28 +26,26 @@ def create_project(server, project_item):

def main():
parser = argparse.ArgumentParser(description='Create new projects.')
# Common options; please keep those in sync across all samples
parser.add_argument('--server', '-s', required=True, help='server address')
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
parser.add_argument('--site', '-S', default=None)
parser.add_argument('-p', default=None, help='password')

parser.add_argument('--site', '-S', help='site name')
parser.add_argument('--token-name', '-p', required=True,
help='name of the personal access token used to sign into the server')
parser.add_argument('--token-value', '-v', required=True,
help='value of the personal access token used to sign into the server')
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
help='desired logging level (set to error by default)')
# Options specific to this sample
# This sample has no additional options, yet. If you add some, please add them here

args = parser.parse_args()

if args.p is None:
password = getpass.getpass("Password: ")
else:
password = args.p

# Set logging level based on user input, or error by default
logging_level = getattr(logging, args.logging_level.upper())
logging.basicConfig(level=logging_level)

tableau_auth = TSC.TableauAuth(args.username, password)
server = TSC.Server(args.server)

tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
server = TSC.Server(args.server, use_server_version=True)
with server.auth.sign_in(tableau_auth):
# Use highest Server REST API version available
server.use_server_version()
Expand Down
19 changes: 12 additions & 7 deletions samples/create_schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# This script demonstrates how to create schedules using the Tableau
# Server Client.
#
# To run the script, you must have installed Python 3.5 or later.
# To run the script, you must have installed Python 3.6 or later.
####


import argparse
import getpass
import logging

from datetime import time
Expand All @@ -18,20 +17,26 @@
def main():

parser = argparse.ArgumentParser(description='Creates sample schedules for each type of frequency.')
# Common options; please keep those in sync across all samples
parser.add_argument('--server', '-s', required=True, help='server address')
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
parser.add_argument('--site', '-S', help='site name')
parser.add_argument('--token-name', '-p', required=True,
help='name of the personal access token used to sign into the server')
parser.add_argument('--token-value', '-v', required=True,
help='value of the personal access token used to sign into the server')
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()
# Options specific to this sample
# This sample has no additional options, yet. If you add some, please add them here

password = getpass.getpass("Password: ")
args = parser.parse_args()

# Set logging level based on user input, or error by default
logging_level = getattr(logging, args.logging_level.upper())
logging.basicConfig(level=logging_level)

tableau_auth = TSC.TableauAuth(args.username, password)
server = TSC.Server(args.server)
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
server = TSC.Server(args.server, use_server_version=True)
with server.auth.sign_in(tableau_auth):
# Hourly Schedule
# This schedule will run every 2 hours between 2:30AM and 11:00PM
Expand Down
31 changes: 13 additions & 18 deletions samples/download_view_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
# For more information, refer to the documentations on 'Query View Image'
# (https://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm)
#
# To run the script, you must have installed Python 3.5 or later.
# To run the script, you must have installed Python 3.6 or later.
####

import argparse
import getpass
import logging

import tableauserverclient as TSC
Expand All @@ -18,34 +17,30 @@
def main():

parser = argparse.ArgumentParser(description='Download image of a specified view.')
# Common options; please keep those in sync across all samples
parser.add_argument('--server', '-s', required=True, help='server address')
parser.add_argument('--site-id', '-si', required=False,
help='content url for site the view is on')
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
parser.add_argument('--view-name', '-v', required=True,
parser.add_argument('--site', '-S', help='site name')
parser.add_argument('--token-name', '-p', required=True,
help='name of the personal access token used to sign into the server')
parser.add_argument('--token-value', '-v', required=True,
help='value of the personal access token used to sign into the server')
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
help='desired logging level (set to error by default)')
# Options specific to this sample
parser.add_argument('--view-name', '-vn', required=True,
help='name of view to download an image of')
parser.add_argument('--filepath', '-f', required=True, help='filepath to save the image returned')
parser.add_argument('--maxage', '-m', required=False, help='max age of the image in the cache in minutes.')
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()

password = getpass.getpass("Password: ")

# Set logging level based on user input, or error by default
logging_level = getattr(logging, args.logging_level.upper())
logging.basicConfig(level=logging_level)

# Step 1: Sign in to server.
site_id = args.site_id
if not site_id:
site_id = ""
tableau_auth = TSC.TableauAuth(args.username, password, site_id=site_id)
server = TSC.Server(args.server)
# The new endpoint was introduced in Version 2.5
server.version = "2.5"

tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
server = TSC.Server(args.server, use_server_version=True)
with server.auth.sign_in(tableau_auth):
# Step 2: Query for the view that we want an image of
req_option = TSC.RequestOptions()
Expand Down
20 changes: 11 additions & 9 deletions samples/explore_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
####

import argparse
import getpass
import logging

import tableauserverclient as TSC
Expand All @@ -19,25 +18,28 @@
def main():

parser = argparse.ArgumentParser(description='Explore datasource functions supported by the Server API.')
# Common options; please keep those in sync across all samples
parser.add_argument('--server', '-s', required=True, help='server address')
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
parser.add_argument('--publish', '-p', metavar='FILEPATH', help='path to datasource to publish')
parser.add_argument('--download', '-d', metavar='FILEPATH', help='path to save downloaded datasource')
parser.add_argument('--site', '-S', help='site name')
parser.add_argument('--token-name', '-p', required=True,
help='name of the personal access token used to sign into the server')
parser.add_argument('--token-value', '-v', required=True,
help='value of the personal access token used to sign into the server')
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
help='desired logging level (set to error by default)')
# Options specific to this sample
parser.add_argument('--publish', metavar='FILEPATH', help='path to datasource to publish')
parser.add_argument('--download', metavar='FILEPATH', help='path to save downloaded datasource')

args = parser.parse_args()

password = getpass.getpass("Password: ")

# Set logging level based on user input, or error by default
logging_level = getattr(logging, args.logging_level.upper())
logging.basicConfig(level=logging_level)

# SIGN IN
tableau_auth = TSC.TableauAuth(args.username, password)
server = TSC.Server(args.server)
server.use_highest_version()
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
server = TSC.Server(args.server, use_server_version=True)
with server.auth.sign_in(tableau_auth):
# Query projects for use when demonstrating publishing and updating
all_projects, pagination_item = server.projects.get()
Expand Down
Loading

0 comments on commit f81039a

Please sign in to comment.