8000 [Release] Sync master with v0.15 changes by shinchris · Pull Request #801 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

[Release] Sync master with v0.15 changes #801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
160fced
Fixes data_acceleration field always in workbook update payload
Nov 19, 2020
ef95e53
Improve debug logging
bcantoni Nov 20, 2020
00bde4e
Add Python 3.9 for CI builds
bcantoni Nov 20, 2020
6550ae1
Merge pull request #741 from tableau/fix_740
Nov 20, 2020
69e927e
Merge pull request #744 from tableau/python39
bcantoni Nov 20, 2020
3f9c65d
Adds support for older server versions that expect different query st…
Nov 20, 2020
0bcff26
Minor fixes
Nov 20, 2020
0aca85b
Limit request content to 1000 bytes, remove redundant response logging
bcantoni Dec 2, 2020
8e1eef5
Merge pull request #743 from tableau/improve-debug-log2
bcantoni Dec 3, 2020
15f7b56
Add Get View by ID
bcantoni Dec 3, 2020
62b264c
Merge pull request #750 from tableau/get-view-id
bcantoni Dec 4, 2020
e624178
Fixes issue #754 by moving file read logic inside generator
Dec 9, 2020
d05ec12
Merge pull request #745 from tableau/fix_732
Dec 9, 2020
a81562d
Merge pull request #757 from tableau/fix_754
Dec 9, 2020
861c653
Improves group creation for both local and AD (#770)
Jan 7, 2021
1c7480f
Fixes groups.update to match server requests/responses (#772)
Jan 20, 2021
f566c05
Fetch project owner on get (#784)
jorwoods Feb 1, 2021
857199b
Update site properties and functions (#777)
tjones-commits Feb 5, 2021
026bca8
Adds skipConnectionCheck to publish workbook (#791)
Feb 11, 2021
88a0188
[Subscriptions] Add new fields and ability to update (#794)
Feb 16, 2021
f64fcf9
MANIFEST.in: Add docs and test data (#780)
jayvdb Feb 16, 2021
fe992ee
[Tasks] Translate task type from server to TSC enum (#796)
Feb 16, 2021
9179637
Add support for getting groups that a user belongs to (#799)
lboynton Feb 16, 2021
6c7a87b
Removes travis and adds linting/testing into github action (#798)
Feb 16, 2021
004ab31
Updates changelog and contributors list for v0.15
Feb 17, 2021
3a8ec6c
Merge branch 'master' into release-0.15
Feb 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Python package

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]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test]

- name: Lint with pycodestyle
run: |
pycodestyle tableauserverclient test samples

- name: Test with pytest
run: |
pytest test
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## 0.15.0 (16 Feb 2021)
* Added support for python version 3.9 (#744)
* Added support for 'Get View by ID' (#750)
* Added docs and test data to MANIFEST.in file (#780)
* Added owner_id property to ProjectItem (#784)
* Added support for skipping connection check while publishing workbook (#791)
* Added support for 'Update Subscription' (#794)
* Added support for 'Get Groups for a User' (#799)
* Improved debug logging by including put/post request contents (#743)
* Improved local and active-directory group creation (#770)
* Improved 'Update Group' to match server requests/responses (#772)
* Improved SiteItem with new properties and functions (#777)
* Improved SubscriptionItem with new properties (#794)
* Improved the 'type' property of TaskItem to convert server response to enum (#796)
* Improved repository to use Github Actions for running tests/linter (#798)
* Fixed data_acceleration field causing error in workbook update payload (#741)

## 0.14.1 (9 Dec 2020)
* Fixed filter query issue for server version below 2020.1 (#745)
* Fixed large workbook/datasource publish issue (#757)
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ The following people have contributed to this project to make it possible, and w
* [Paul Vickers](https: A93C //github.com/paulvic)
* [Madhura Selvarajan](https://github.com/maddy-at-leisure)
* [Niklas Nevalainen](https://github.com/nnevalainen)
* [Terrence Jones](https://github.com/tjones-commits)
* [John Vandenberg](https://github.com/jayvdb)
* [Lee Boynton](https://github.com/lboynton)

## Core Team

Expand Down
19 changes: 19 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,22 @@ include versioneer.py
include tableauserverclient/_version.py
include LICENSE
include LICENSE.versioneer
include README.md
include CHANGELOG.md
recursive-include docs *.md
recursive-include samples *.py
recursive-include samples *.txt
recursive-include smoke *.py
recursive-include test *.csv
recursive-include test *.dict
recursive-include test *.hyper
recursive-include test *.json
recursive-include test *.pdf
recursive-include test *.png
recursive-include test *.py
recursive-include test *.tde
recursive-include test *.tds
recursive-include test *.tdsx
recursive-include test *.twb
recursive-include test *.twbx
recursive-include test *.xml
7 changes: 5 additions & 2 deletions samples/publish_workbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def main():
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
help='desired logging level (set to error by default)')
parser.add_argument('--as-job', '-a', help='Publishing asynchronously', action='store_true')
parser.add_argument('--skip-connection-check', '-c', help='Skip live connection check', action='store_true')
parser.add_argument('--site', '-S', default='', help='id (contentUrl) of site to sign into')

args = parser.parse_args()
Expand Down Expand Up @@ -71,11 +72,13 @@ def main():
new_workbook = TSC.WorkbookItem(default_project.id)
if args.as_job:
new_job = server.workbooks.publish(new_workbook, args.filepath, overwrite_true,
connections=all_connections, as_job=args.as_job)
connections=all_connections, as_job=args.as_job,
skip_connection_check=args.skip_connection_check)
print("Workbook published. JOB ID: {0}".format(new_job.id))
else:
new_workbook = server.workbooks.publish(new_workbook, args.filepath, overwrite_true,
connections=all_connections, as_job=args.as_job)
connections=all_connections, as_job=args.as_job,
skip_connection_check=args.skip_connection_check)
print("Workbook published. ID: {0}".format(new_workbook.id))
else:
error = "The default project could not be found."
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# This makes work easier for offline installs or low bandwidth machines
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
test_requirements = ['mock', 'pycodestyle', 'pytest', 'requests-mock>=1.0,<2.0']

setup(
name='tableauserverclient',
Expand All @@ -34,9 +35,8 @@
install_requires=[
'requests>=2.11,<3.0',
],
tests_require=[
'requests-mock>=1.0,<2.0',
'pytest',
'mock'
]
tests_require=test_requirements,
extras_require={
'test': test_requirements
}
)
35 changes: 20 additions & 15 deletions tableauserverclient/models/group_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ class GroupItem(object):

tag_name = 'group'

def __init__(self, name=None):
self._domain_name = None
class LicenseMode:
onLogin = 'onLogin'
onSync = 'onSync'

def __init__(self, name=None, domain_name=None):
self._id = None
self._users = None
self.name = name
self._license_mode = None
self._minimum_site_role = None
self._users = None
self.name = name
self.domain_name = domain_name

@property
def domain_name(self):
Expand Down Expand Up @@ -43,8 +47,8 @@ def license_mode(self):
return self._license_mode

@license_mode.setter
@property_is_enum(LicenseMode)
def license_mode(self, value):
# valid values = onSync, onLogin
self._license_mode = value

@property
Expand Down Expand Up @@ -79,17 +83,18 @@ def from_response(cls, resp, ns):
name = group_xml.get('name', None)
group_item = cls(name)
group_item._id = group_xml.get('id', None)
# AD groups have an extra element under this

# Domain name is returned in a domain element for some calls
domain_elem = group_xml.find('.//t:domain', namespaces=ns)
if domain_elem is not None:
group_item.domain_name = domain_elem.get('name', None)

# Import element is returned for both local and AD groups (2020.3+)
import_elem = group_xml.find('.//t:import', namespaces=ns)
if (import_elem is not None):
group_item.domain_name = import_elem.get('domainName')
group_item.license_mode = import_elem.get('grantLicenseMode')
group_item.minimum_site_role = import_elem.get('siteRole')
else:
# local group, we will just have two extra attributes here
group_item.domain_name = 'local'
group_item.license_mode = group_xml.get('grantLicenseMode')
group_item.minimum_site_role = group_xml.get('siteRole')
if import_elem is not None:
group_item.domain_name = import_elem.get('domainName', None)
group_item.license_mode = import_elem.get('grantLicenseMode', None)
group_item.minimum_site_role = import_elem.get('siteRole', None)

all_group_items.append(group_item)
return all_group_items
Expand Down
21 changes: 17 additions & 4 deletions tableauserverclient/models/project_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ def name(self):
def name(self, value):
self._name = value

@property
def owner_id(self):
return self._owner_id

@owner_id.setter
def owner_id(self, value):
raise NotImplementedError('REST API does not currently support updating project owner.')

def is_default(self):
return self.name.lower() == 'default'

Expand All @@ -86,7 +94,7 @@ def _parse_common_tags(self, project_xml, ns):
self._set_values(None, name, description, content_permissions, parent_id)
return self

def _set_values(self, project_id, name, description, content_permissions, parent_id):
def _set_values(self, project_id, name, description, content_permissions, parent_id, owner_id):
if project_id is not None:
self._id = project_id
if name:
Expand All @@ -97,6 +105,8 @@ def _set_values(self, project_id, name, description, content_permissions, parent
self._content_permissions = content_permissions
if parent_id:
self.parent_id = parent_id
if owner_id:
self._owner_id = owner_id

def _set_permissions(self, permissions):
self._permissions = permissions
Expand All @@ -111,9 +121,9 @@ def from_response(cls, resp, ns):
all_project_xml = parsed_response.findall('.//t:project', namespaces=ns)

for project_xml in all_project_xml:
(id, name, description, content_permissions, parent_id) = cls._parse_element(project_xml)
(id, name, description, content_permissions, parent_id, owner_id) = cls._parse_element(project_xml)
project_item = cls(name)
project_item._set_values(id, name, description, content_permissions, parent_id)
project_item._set_values(id, name, description, content_permissions, parent_id, owner_id)
all_project_items.append(project_item)
return all_project_items

Expand All @@ -124,5 +134,8 @@ def _parse_element(project_xml):
description = project_xml.get('description', None)
content_permissions = project_xml.get('contentPermissions', None)
parent_id = project_xml.get('parentProjectId', None)
owner_id = None
for owner in project_xml:
owner_id = owner.get('id', None)

return id, name, description, content_permissions, parent_id
return id, name, description, content_permissions, parent_id, owner_id
Loading
0