Skip to content

Commit

Permalink
Merge pull request tableau#1444 from tableau/development
Browse files Browse the repository at this point in the history
v0.33

Features:
- add name, datasource-name to Job item
- enable bulk add and remove users
- Linked Tasks: get, get by ID, run Now
- implement Tags: create new, add/delete for workbooks, flows, datasources
- get page and chunk size from env vars
- add some repr implementations
- implement virtual connections

Bugfix:
- tableau#1447
- tableau#1449
  • Loading branch information
jacalata authored Sep 17, 2024
2 parents 257cf61 + 4584717 commit 4259316
Show file tree
Hide file tree
Showing 71 changed files with 3,127 additions and 277 deletions.
126 changes: 73 additions & 53 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,79 @@ The following people have contributed to this project to make it possible, and w

## Contributors

* [jacalata](https://github.com/jacalata)
* [jorwoods](https://github.com/jorwoods)
* [t8y8](https://github.com/t8y8)
* [bcantoni](https://github.com/bcantoni)
* [shinchris](https://github.com/shinchris)
* [vogelsgesang](https://github.com/vogelsgesang)
* [lbrendanl](https://github.com/lbrendanl)
* [LGraber](https://github.com/LGraber)
* [gaoang2148](https://github.com/gaoang2148)
* [benlower](https://github.com/benlower)
* [liu-rebecca](https://github.com/liu-rebecca)
* [guodah](https://github.com/guodah)
* [jdomingu](https://github.com/jdomingu)
* [kykrueger](https://github.com/kykrueger)
* [jz-huang](https://github.com/jz-huang)
* [opus-42](https://github.com/opus-42)
* [markm-io](https://github.com/markm-io)
* [graysonarts](https://github.com/graysonarts)
* [d45](https://github.com/d45)
* [preguraman](https://github.com/preguraman)
* [sotnich](https://github.com/sotnich)
* [mmuttreja-tableau](https://github.com/mmuttreja-tableau)
* [dependabot[bot]](https://github.com/apps/dependabot)
* [scuml](https://github.com/scuml)
* [ovinis](https://github.com/ovinis)
* [FFMMM](https://github.com/FFMMM)
* [martinbpeters](https://github.com/martinbpeters)
* [talvalin](https://github.com/talvalin)
* [dzucker-tab](https://github.com/dzucker-tab)
* [a-torres-2](https://github.com/a-torres-2)
* [nnevalainen](https://github.com/nnevalainen)
* [mbren](https://github.com/mbren)
* [wolkiewiczk](https://github.com/wolkiewiczk)
* [jacobj10](https://github.com/jacobj10)
* [hugoboos](https://github.com/hugoboos)
* [grbritz](https://github.com/grbritz)
* [fpagliar](https://github.com/fpagliar)
* [bskim45](https://github.com/bskim45)
* [baixin137](https://github.com/baixin137)
* [jessicachen79](https://github.com/jessicachen79)
* [gconklin](https://github.com/gconklin)
* [geordielad](https://github.com/geordielad)
* [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)
* [William Lang](https://github.com/williamlang)
* [Jim Morris](https://github.com/jimbodriven)
* [BingoDinkus](https://github.com/BingoDinkus)
* [Sergey Sotnichenko](https://github.com/sotnich)
* [Bruce Zhang](https://github.com/baixin137)
* [Bumsoo Kim](https://github.com/bskim45)
* [fossabot](https://github.com/fossabot)
* [daniel1608](https://github.com/daniel1608)
* [Joshua Jacob](https://github.com/jacobj10)
* [Francisco Pagliaricci](https://github.com/fpagliar)
* [Tomasz Machalski](https://github.com/toomyem)
* [Jared Dominguez](https://github.com/jdomingu)
* [Brendan Lee](https://github.com/lbrendanl)
* [Martin Dertz](https://github.com/martydertz)
* [Christian Oliff](https://github.com/coliff)
* [Albin Antony](https://github.com/user9747)
* [prae04](https://github.com/prae04)
* [Martin Peters](https://github.com/martinbpeters)
* [Sherman K](https://github.com/shrmnk)
* [Jorge Fonseca](https://github.com/JorgeFonseca)
* [Kacper Wolkiewicz](https://github.com/wolkiewiczk)
* [Dahai Guo](https://github.com/guodah)
* [Geraldine Zanolli](https://github.com/illonage)
* [Jordan Woods](https://github.com/jorwoods)
* [Reba Magier](https://github.com/rmagier1)
* [Stephen Mitchell](https://github.com/scuml)
* [absentmoose](https://github.com/absentmoose)
* [Paul Vickers](https://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)
* [annematronic](https://github.com/annematronic)

## Core Team

* [Chris Shin](https://github.com/shinchris)
* [Lee Graber](https://github.com/lgraber)
* [Tyler Doyle](https://github.com/t8y8)
* [Russell Hay](https://github.com/RussTheAerialist)
* [Ben Lower](https://github.com/benlower)
* [Ang Gao](https://github.com/gaoang2148)
* [Priya Reguraman](https://github.com/preguraman)
* [Jac Fitzgerald](https://github.com/jacalata)
* [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)
* [rshide](https://github.com/rshide)
* [VathsalaAchar](https://github.com/VathsalaAchar)
* [TrimPeachu](https://github.com/TrimPeachu)
* [ajbosco](https://github.com/ajbosco)
* [jimbodriven](https://github.com/jimbodriven)
* [ltiffanydev](https://github.com/ltiffanydev)
* [martydertz](https://github.com/martydertz)
* [r-richmond](https://github.com/r-richmond)
* [sfarr15](https://github.com/sfarr15)
* [tagyoureit](https://github.com/tagyoureit)
* [tjones-commits](https://github.com/tjones-commits)
* [yoshichan5](https://github.com/yoshichan5)
* [wlodi83](https://github.com/wlodi83)
* [anipmehta](https://github.com/anipmehta)
* [cmtoomey](https://github.com/cmtoomey)
* [pes-magic](https://github.com/pes-magic)
* [illonage](https://github.com/illonage)
* [jayvdb](https://github.com/jayvdb)
* [jorgeFons](https://github.com/jorgeFons)
* [Kovner](https://github.com/Kovner)
* [LarsBreddemann](https://github.com/LarsBreddemann)
* [lboynton](https://github.com/lboynton)
* [maddy-at-leisure](https://github.com/maddy-at-leisure)
* [narcolino-tableau](https://github.com/narcolino-tableau)
* [PatrickfBraz](https://github.com/PatrickfBraz)
* [paulvic](https://github.com/paulvic)
* [shrmnk](https://github.com/shrmnk)
* [TableauKyle](https://github.com/TableauKyle)
* [bossenti](https://github.com/bossenti)
* [ma7tcsp](https://github.com/ma7tcsp)
* [toomyem](https://github.com/toomyem)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ 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 for the library and sample files showing how to use it. As of May 2022, Python versions 3.7 and up are supported.
This repository contains Python source code for the library and sample files showing how to use it. As of September 2024, support for Python 3.7 and 3.8 will be dropped - support for older versions of Python aims to match https://devguide.python.org/versions/

To see sample code that works directly with the REST API (in Java, Python, or Postman), visit the [REST API Samples](https://github.com/tableau/rest-api-samples) repo.

For more information on installing and using TSC, see the documentation:
<https://tableau.github.io/server-client-python/docs/>


To contribute, see our [Developer Guide](https://tableau.github.io/server-client-python/docs/dev-guide). A list of all our contributors to date is in [CONTRIBUTORS.md].

## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftableau%2Fserver-client-python.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftableau%2Fserver-client-python?ref=badge_large)
65 changes: 2 additions & 63 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Contribution can include, but are not limited to, any of the following:
* Fix an Issue/Bug
* Add/Fix documentation

Contributions must follow the guidelines outlined on the [Tableau Organization](http://tableau.github.io/) page, though filing an issue or requesting a feature do not require the CLA.

## Issues and Feature Requests

To submit an issue/bug report, or to request a feature, please submit a [GitHub issue](https://github.com/tableau/server-client-python/issues) to the repo.
Expand All @@ -22,65 +20,6 @@ files to assist in the repro. **Be sure to scrub the files of any potentially s
For a feature request, please try to describe the scenario you are trying to accomplish that requires the feature. This will help us understand
the limitations that you are running into, and provide us with a use case to know if we've satisfied your request.

### Label usage on Issues

The core team is responsible for assigning most labels to the issue. Labels
are used for prioritizing the core team's work, and use the following
definitions for labels.

The following labels are only to be set or changed by the core team:

* **bug** - A bug is an unintended behavior for existing functionality. It only relates to existing functionality and the behavior that is expected with that functionality. We do not use **bug** to indicate priority.
* **enhancement** - An enhancement is a new piece of functionality and is related to the fact that new code will need to be written in order to close this issue. We do not use **enhancement** to indicate priority.
* **CLARequired** - This label is used to indicate that the contribution will require that the CLA is signed before we can accept a PR. This label should not be used on Issues
* **CLANotRequired** - This label is used to indicate that the contribution does not require a CLA to be signed. This is used for minor fixes and usually around doc fixes or correcting strings.
* **help wanted** - This label on an issue indicates it's a good choice for external contributors to take on. It usually means it's an issue that can be tackled by first time contributors.

The following labels can be used by the issue creator or anyone in the
community to help us prioritize enhancement and bug fixes that are
causing pain from our users. The short of it is, purple tags are ones that
anyone can add to an issue:

* **Critical** - This means that you won't be able to use the library until the issues have been resolved. If an issue is already labeled as critical, but you want to show your support for it, add a +1 comment to the issue. This helps us know what issues are really impacting our users.
* **Nice To Have** - This means that the issue doesn't block your usage of the library, but would make your life easier. Like with critical, if the issue is already tagged with this, but you want to show your support, add a +1 comment to the issue.

## Fixes, Implementations, and Documentation

For all other things, please submit a PR that includes the fix, documentation, or new code that you are trying to contribute. More information on
creating a PR can be found in the [Development Guide](https://tableau.github.io/server-client-python/docs/dev-guide).

If the feature is complex or has multiple solutions that could be equally appropriate approaches, it would be helpful to file an issue to discuss the
design trade-offs of each solution before implementing, to allow us to collectively arrive at the best solution, which most likely exists in the middle
somewhere.

## Getting Started

```shell
python -m build
pytest
```

### To use your locally built version
```shell
pip install .
```

### Debugging Tools
See what your outgoing requests look like: https://requestbin.net/ (unaffiliated link not under our control)


### Before Committing

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.

```shell
# this will run the formatter without making changes
black . --check

# this will format the directory and code for you
black .
### Making Contributions

# this will run type checking
pip install mypy
mypy tableauserverclient test samples
```
Refer to the [Developer Guide](https://tableau.github.io/server-client-python/docs/dev-guide) which explains how to make contributions to the TSC project.
9 changes: 9 additions & 0 deletions getcontributors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import json
import requests


logins = json.loads(
requests.get("https://api.github.com/repos/tableau/server-client-python/contributors?per_page=200").text
)
for login in logins:
print(f"* [{login["login"]}]({login["html_url"]})")
10 changes: 10 additions & 0 deletions tableauserverclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
FlowRunItem,
FileuploadItem,
GroupItem,
GroupSetItem,
HourlyInterval,
IntervalItem,
JobItem,
JWTAuth,
LinkedTaskItem,
LinkedTaskStepItem,
LinkedTaskFlowRunItem,
MetricItem,
MonthlyInterval,
PaginationItem,
Expand All @@ -39,6 +43,7 @@
TaskItem,
UserItem,
ViewItem,
VirtualConnectionItem,
WebhookItem,
WeeklyInterval,
WorkbookItem,
Expand Down Expand Up @@ -79,6 +84,7 @@
"FlowRunItem",
"FileuploadItem",
"GroupItem",
"GroupSetItem",
"HourlyInterval",
"IntervalItem",
"JobItem",
Expand Down Expand Up @@ -116,4 +122,8 @@
"Pager",
"Server",
"Sort",
"LinkedTaskItem",
"LinkedTaskStepItem",
"LinkedTaskFlowRunItem",
"VirtualConnectionItem",
]
20 changes: 16 additions & 4 deletions tableauserverclient/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
# TODO: check for env variables, else set default values
import os

ALLOWED_FILE_EXTENSIONS = ["tds", "tdsx", "tde", "hyper", "parquet"]

BYTES_PER_MB = 1024 * 1024

# For when a datasource is over 64MB, break it into 5MB(standard chunk size) chunks
CHUNK_SIZE_MB = 5 * 10 # 5MB felt too slow, upped it to 50

DELAY_SLEEP_SECONDS = 0.1

# The maximum size of a file that can be published in a single request is 64MB
FILESIZE_LIMIT_MB = 64


class Config:
# For when a datasource is over 64MB, break it into 5MB(standard chunk size) chunks
@property
def CHUNK_SIZE_MB(self):
return int(os.getenv("TSC_CHUNK_SIZE_MB", 5 * 10)) # 5MB felt too slow, upped it to 50

# Default page size
@property
def PAGE_SIZE(self):
return int(os.getenv("TSC_PAGE_SIZE", 100))


config = Config()
12 changes: 12 additions & 0 deletions tableauserverclient/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from tableauserverclient.models.flow_item import FlowItem
from tableauserverclient.models.flow_run_item import FlowRunItem
from tableauserverclient.models.group_item import GroupItem
from tableauserverclient.models.groupset_item import GroupSetItem
from tableauserverclient.models.interval_item import (
IntervalItem,
DailyInterval,
Expand All @@ -22,6 +23,11 @@
HourlyInterval,
)
from tableauserverclient.models.job_item import JobItem, BackgroundJobItem
from tableauserverclient.models.linked_tasks_item import (
LinkedTaskItem,
LinkedTaskStepItem,
LinkedTaskFlowRunItem,
)
from tableauserverclient.models.metric_item import MetricItem
from tableauserverclient.models.pagination_item import PaginationItem
from tableauserverclient.models.permissions_item import PermissionsRule, Permission
Expand All @@ -39,6 +45,7 @@
from tableauserverclient.models.task_item import TaskItem
from tableauserverclient.models.user_item import UserItem
from tableauserverclient.models.view_item import ViewItem
from tableauserverclient.models.virtual_connection_item import VirtualConnectionItem
from tableauserverclient.models.webhook_item import WebhookItem
from tableauserverclient.models.workbook_item import WorkbookItem

Expand All @@ -60,6 +67,7 @@
"FlowItem",
"FlowRunItem",
"GroupItem",
"GroupSetItem",
"IntervalItem",
"JobItem",
"DailyInterval",
Expand Down Expand Up @@ -89,6 +97,10 @@
"TaskItem",
"UserItem",
"ViewItem",
"VirtualConnectionItem",
"WebhookItem",
"WorkbookItem",
"LinkedTaskItem",
"LinkedTaskStepItem",
"LinkedTaskFlowRunItem",
]
6 changes: 4 additions & 2 deletions tableauserverclient/models/connection_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ def from_response(cls, resp, ns) -> List["ConnectionItem"]:
for connection_xml in all_connection_xml:
connection_item = cls()
connection_item._id = connection_xml.get("id", None)
connection_item._connection_type = connection_xml.get("type", None)
connection_item._connection_type = connection_xml.get("type", connection_xml.get("dbClass", None))
connection_item.embed_password = string_to_bool(connection_xml.get("embedPassword", ""))
connection_item.server_address = connection_xml.get("serverAddress", None)
connection_item.server_port = connection_xml.get("serverPort", None)
connection_item.username = connection_xml.get("userName", None)
connection_item._query_tagging = string_to_bool(connection_xml.get("queryTaggingEnabled", None))
connection_item._query_tagging = (
string_to_bool(s) if (s := connection_xml.get("queryTagging", None)) else None
)
datasource_elem = connection_xml.find(".//t:datasource", namespaces=ns)
if datasource_elem is not None:
connection_item._datasource_id = datasource_elem.get("id", None)
Expand Down
6 changes: 6 additions & 0 deletions tableauserverclient/models/database_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ def __init__(self, name, description=None, content_permissions=None):

self._tables = None # Not implemented yet

def __str__(self):
return "<Database {0} '{1}'>".format(self._id, self.name)

def __repr__(self):
return self.__str__() + " { " + ", ".join(" % s: % s" % item for item in vars(self).items()) + "}"

@property
def dqws(self):
if self._data_quality_warnings is None:
Expand Down
Loading

0 comments on commit 4259316

Please sign in to comment.