Skip to content

Commit

Permalink
Merge pull request #1427 from tableau/development
Browse files Browse the repository at this point in the history
v0.32 release - urllib update
  • Loading branch information
bcantoni authored Jul 27, 2024
2 parents 777db4e + b9b3644 commit 257cf61
Show file tree
Hide file tree
Showing 45 changed files with 813 additions and 496 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,4 @@ docs/_site/
docs/.jekyll-metadata
docs/Gemfile.lock
samples/credentials
.venv/
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers = [
repository = "https://github.com/tableau/server-client-python"

[project.optional-dependencies]
test = ["argparse", "black==23.7", "mock", "mypy==1.4", "pytest>=7.0", "pytest-cov", "pytest-subtests",
test = ["black==23.7", "build", "mypy==1.4", "pytest>=7.0", "pytest-cov", "pytest-subtests",
"requests-mock>=1.0,<2.0"]

[tool.black]
Expand All @@ -49,6 +49,8 @@ disable_error_code = [
files = ["tableauserverclient", "test"]
show_error_codes = true
ignore_missing_imports = true # defusedxml library has no types
no_implicit_reexport = true

[tool.pytest.ini_options]
testpaths = ["test"]
addopts = "--junitxml=./test.junit.xml"
68 changes: 64 additions & 4 deletions tableauserverclient/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ._version import get_versions
from .namespace import NEW_NAMESPACE as DEFAULT_NAMESPACE
from .models import (
from tableauserverclient._version import get_versions
from tableauserverclient.namespace import NEW_NAMESPACE as DEFAULT_NAMESPACE
from tableauserverclient.models import (
BackgroundJobItem,
ColumnItem,
ConnectionCredentials,
Expand Down Expand Up @@ -43,7 +43,8 @@
WeeklyInterval,
WorkbookItem,
)
from .server import (

from tableauserverclient.server import (
CSVRequestOptions,
ExcelRequestOptions,
ImageRequestOptions,
Expand All @@ -57,3 +58,62 @@
Server,
Sort,
)

__all__ = [
"get_versions",
"DEFAULT_NAMESPACE",
"BackgroundJobItem",
"BackgroundJobItem",
"ColumnItem",
"ConnectionCredentials",
"ConnectionItem",
"CustomViewItem",
"DQWItem",
"DailyInterval",
"DataAlertItem",
"DatabaseItem",
"DataFreshnessPolicyItem",
"DatasourceItem",
"FavoriteItem",
"FlowItem",
"FlowRunItem",
"FileuploadItem",
"GroupItem",
"HourlyInterval",
"IntervalItem",
"JobItem",
"JWTAuth",
"MetricItem",
"MonthlyInterval",
"PaginationItem",
"Permission",
"PermissionsRule",
"PersonalAccessTokenAuth",
"ProjectItem",
"RevisionItem",
"ScheduleItem",
"SiteItem",
"ServerInfoItem",
"SubscriptionItem",
"TableItem",
"TableauAuth",
"Target",
"TaskItem",
"UserItem",
"ViewItem",
"WebhookItem",
"WeeklyInterval",
"WorkbookItem",
"CSVRequestOptions",
"ExcelRequestOptions",
"ImageRequestOptions",
"PDFRequestOptions",
"RequestOptions",
"MissingRequiredFieldError",
"NotSignedInError",
"ServerResponseError",
"Filter",
"Pager",
"Server",
"Sort",
]
125 changes: 88 additions & 37 deletions tableauserverclient/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,94 @@
from .column_item import ColumnItem
from .connection_credentials import ConnectionCredentials
from .connection_item import ConnectionItem
from .custom_view_item import CustomViewItem
from .data_acceleration_report_item import DataAccelerationReportItem
from .data_alert_item import DataAlertItem
from .database_item import DatabaseItem
from .data_freshness_policy_item import DataFreshnessPolicyItem
from .datasource_item import DatasourceItem
from .dqw_item import DQWItem
from .exceptions import UnpopulatedPropertyError
from .favorites_item import FavoriteItem
from .fileupload_item import FileuploadItem
from .flow_item import FlowItem
from .flow_run_item import FlowRunItem
from .group_item import GroupItem
from .interval_item import (
from tableauserverclient.models.column_item import ColumnItem
from tableauserverclient.models.connection_credentials import ConnectionCredentials
from tableauserverclient.models.connection_item import ConnectionItem
from tableauserverclient.models.custom_view_item import CustomViewItem
from tableauserverclient.models.data_acceleration_report_item import DataAccelerationReportItem
from tableauserverclient.models.data_alert_item import DataAlertItem
from tableauserverclient.models.database_item import DatabaseItem
from tableauserverclient.models.data_freshness_policy_item import DataFreshnessPolicyItem
from tableauserverclient.models.datasource_item import DatasourceItem
from tableauserverclient.models.dqw_item import DQWItem
from tableauserverclient.models.exceptions import UnpopulatedPropertyError
from tableauserverclient.models.favorites_item import FavoriteItem
from tableauserverclient.models.fileupload_item import FileuploadItem
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.interval_item import (
IntervalItem,
DailyInterval,
WeeklyInterval,
MonthlyInterval,
HourlyInterval,
)
from .job_item import JobItem, BackgroundJobItem
from .metric_item import MetricItem
from .pagination_item import PaginationItem
from .permissions_item import PermissionsRule, Permission
from .project_item import ProjectItem
from .revision_item import RevisionItem
from .schedule_item import ScheduleItem
from .server_info_item import ServerInfoItem
from .site_item import SiteItem
from .subscription_item import SubscriptionItem
from .table_item import TableItem
from .tableau_auth import Credentials, TableauAuth, PersonalAccessTokenAuth, JWTAuth
from .tableau_types import Resource, TableauItem, plural_type
from .tag_item import TagItem
from .target import Target
from .task_item import TaskItem
from .user_item import UserItem
from .view_item import ViewItem
from .webhook_item import WebhookItem
from .workbook_item import WorkbookItem
from tableauserverclient.models.job_item import JobItem, BackgroundJobItem
from tableauserverclient.models.metric_item import MetricItem
from tableauserverclient.models.pagination_item import PaginationItem
from tableauserverclient.models.permissions_item import PermissionsRule, Permission
from tableauserverclient.models.project_item import ProjectItem
from tableauserverclient.models.revision_item import RevisionItem
from tableauserverclient.models.schedule_item import ScheduleItem
from tableauserverclient.models.server_info_item import ServerInfoItem
from tableauserverclient.models.site_item import SiteItem
from tableauserverclient.models.subscription_item import SubscriptionItem
from tableauserverclient.models.table_item import TableItem
from tableauserverclient.models.tableau_auth import Credentials, TableauAuth, PersonalAccessTokenAuth, JWTAuth
from tableauserverclient.models.tableau_types import Resource, TableauItem, plural_type
from tableauserverclient.models.tag_item import TagItem
from tableauserverclient.models.target import Target
from tableauserverclient.models.task_item import TaskItem
from tableauserverclient.models.user_item import UserItem
from tableauserverclient.models.view_item import ViewItem
from tableauserverclient.models.webhook_item import WebhookItem
from tableauserverclient.models.workbook_item import WorkbookItem

__all__ = [
"ColumnItem",
"ConnectionCredentials",
"ConnectionItem",
"Credentials",
"CustomViewItem",
"DataAccelerationReportItem",
"DataAlertItem",
"DatabaseItem",
"DataFreshnessPolicyItem",
"DatasourceItem",
"DQWItem",
"UnpopulatedPropertyError",
"FavoriteItem",
"FileuploadItem",
"FlowItem",
"FlowRunItem",
"GroupItem",
"IntervalItem",
"JobItem",
"DailyInterval",
"WeeklyInterval",
"MonthlyInterval",
"HourlyInterval",
"BackgroundJobItem",
"MetricItem",
"PaginationItem",
"Permission",
"PermissionsRule",
"ProjectItem",
"RevisionItem",
"ScheduleItem",
"ServerInfoItem",
"SiteItem",
"SubscriptionItem",
"TableItem",
"TableauAuth",
"PersonalAccessTokenAuth",
"JWTAuth",
"Resource",
"TableauItem",
"plural_type",
"TagItem",
"Target",
"TaskItem",
"UserItem",
"ViewItem",
"WebhookItem",
"WorkbookItem",
]
24 changes: 18 additions & 6 deletions tableauserverclient/models/datasource_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
from defusedxml.ElementTree import fromstring

from tableauserverclient.datetime_helpers import parse_datetime
from .connection_item import ConnectionItem
from .exceptions import UnpopulatedPropertyError
from .permissions_item import PermissionsRule
from .property_decorators import (
from tableauserverclient.models.connection_item import ConnectionItem
from tableauserverclient.models.exceptions import UnpopulatedPropertyError
from tableauserverclient.models.permissions_item import PermissionsRule
from tableauserverclient.models.property_decorators import (
property_not_nullable,
property_is_boolean,
property_is_enum,
)
from .revision_item import RevisionItem
from .tag_item import TagItem
from tableauserverclient.models.revision_item import RevisionItem
from tableauserverclient.models.tag_item import TagItem


class DatasourceItem(object):
Expand Down Expand Up @@ -47,6 +47,7 @@ def __init__(self, project_id: Optional[str] = None, name: Optional[str] = None)
self._initial_tags: Set = set()
self._project_name: Optional[str] = None
self._revisions = None
self._size: Optional[int] = None
self._updated_at = None
self._use_remote_query_agent = None
self._webpage_url = None
Expand Down Expand Up @@ -182,6 +183,10 @@ def revisions(self) -> List[RevisionItem]:
raise UnpopulatedPropertyError(error)
return self._revisions()

@property
def size(self) -> Optional[int]:
return self._size

def _set_connections(self, connections):
self._connections = connections

Expand Down Expand Up @@ -217,6 +222,7 @@ def _parse_common_elements(self, datasource_xml, ns):
updated_at,
use_remote_query_agent,
webpage_url,
size,
) = self._parse_element(datasource_xml, ns)
self._set_values(
ask_data_enablement,
Expand All @@ -237,6 +243,7 @@ def _parse_common_elements(self, datasource_xml, ns):
updated_at,
use_remote_query_agent,
webpage_url,
size,
)
return self

Expand All @@ -260,6 +267,7 @@ def _set_values(
updated_at,
use_remote_query_agent,
webpage_url,
size,
):
if ask_data_enablement is not None:
self._ask_data_enablement = ask_data_enablement
Expand Down Expand Up @@ -297,6 +305,8 @@ def _set_values(
self._use_remote_query_agent = str(use_remote_query_agent).lower() == "true"
if webpage_url:
self._webpage_url = webpage_url
if size is not None:
self._size = int(size)

@classmethod
def from_response(cls, resp: str, ns: Dict) -> List["DatasourceItem"]:
Expand Down Expand Up @@ -330,6 +340,7 @@ def _parse_element(datasource_xml: ET.Element, ns: Dict) -> Tuple:
has_extracts = datasource_xml.get("hasExtracts", None)
use_remote_query_agent = datasource_xml.get("useRemoteQueryAgent", None)
webpage_url = datasource_xml.get("webpageUrl", None)
size = datasource_xml.get("size", None)

tags = None
tags_elem = datasource_xml.find(".//t:tags", namespaces=ns)
Expand Down Expand Up @@ -372,4 +383,5 @@ def _parse_element(datasource_xml: ET.Element, ns: Dict) -> Tuple:
updated_at,
use_remote_query_agent,
webpage_url,
size,
)
14 changes: 7 additions & 7 deletions tableauserverclient/models/favorites_item.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import logging

from defusedxml.ElementTree import fromstring
from .tableau_types import TableauItem
from tableauserverclient.models.tableau_types import TableauItem

from .datasource_item import DatasourceItem
from .flow_item import FlowItem
from .project_item import ProjectItem
from .metric_item import MetricItem
from .view_item import ViewItem
from .workbook_item import WorkbookItem
from tableauserverclient.models.datasource_item import DatasourceItem
from tableauserverclient.models.flow_item import FlowItem
from tableauserverclient.models.project_item import ProjectItem
from tableauserverclient.models.metric_item import MetricItem
from tableauserverclient.models.view_item import ViewItem
from tableauserverclient.models.workbook_item import WorkbookItem
from typing import Dict, List

from tableauserverclient.helpers.logging import logger
Expand Down
Loading

0 comments on commit 257cf61

Please sign in to comment.