8000 Merge pull request #1435 from jorwoods/jorwoods/filter_docstrings · tableau/server-client-python@a3028d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit a3028d7

Browse files
authored
Merge pull request #1435 from jorwoods/jorwoods/filter_docstrings
docs: add docstrings detailing the filter options
2 parents 8d8adbd + 3a47c28 commit a3028d7

11 files changed

+524
-0
lines changed

tableauserverclient/server/endpoint/datasources_endpoint.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from typing import List, Mapping, Optional, Sequence, Tuple, TYPE_CHECKING, Union
1010

1111
from tableauserverclient.helpers.headers import fix_filename
12+
from tableauserverclient.server.query import QuerySet
1213

1314
if TYPE_CHECKING:
1415
from tableauserverclient.server import Server
@@ -459,3 +460,87 @@ def schedule_extract_refresh(
459460
self, schedule_id: str, item: DatasourceItem
460461
) -> List["AddResponse"]: # actually should return a task
461462
return self.parent_srv.schedules.add_to_schedule(schedule_id, datasource=item)
463+
464+
def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[DatasourceItem]:
465+
"""
466+
Queries the Tableau Server for items using the specified filters. Page
467+
size can be specified to limit the number of items returned in a single
468+
request. If not specified, the default page size is 100. Page size can
469+
be an integer between 1 and 1000.
470+
471+
No positional arguments are allowed. All filters must be specified as
472+
keyword arguments. If you use the equality operator, you can specify it
473+
through <field_name>=<value>. If you want to use a different operator,
474+
you can specify it through <field_name>__<operator>=<value>. Field
475+
names can either be in snake_case or camelCase.
476+
477+
This endpoint supports the following fields and operators:
478+
479+
480+
authentication_type=...
481+
authentication_type__in=...
482+
connected_workbook_type=...
483+
connected_workbook_type__gt=...
484+
connected_workbook_type__gte=...
485+
connected_workbook_type__lt=...
486+
connected_workbook_type__lte=...
487+
connection_to=...
488+
connection_to__in=...
489+
connection_type=...
490+
connection_type__in=...
491+
content_url=...
492+
content_url__in=...
493+
created_at=...
494+
created_at__gt=...
495+
created_at__gte=...
496+
created_at__lt=...
497+
created_at__lte=...
498+
database_name=...
499+
database_name__in=...
500+
database_user_name=...
501+
database_user_name__in=...
502+
description=...
503+
description__in=...
504+
favorites_total=...
505+
favorites_total__gt=...
506+
favorites_total__gte=...
507+
favorites_total__lt=...
508+
favorites_total__lte=...
509+
has_alert=...
510+
has_embedded_password=...
511+
has_extracts=...
512+
is_certified=...
513+
is_connectable=...
514+
is_default_port=...
515+
is_hierarchical=...
516+
is_published=...
517+
name=...
518+
name__in=...
519+
owner_domain=...
520+
owner_domain__in=...
521+
owner_email=...
522+
owner_name=...
523+
owner_name__in=...
524+
project_name=...
525+
project_name__in=...
526+
server_name=...
527+
server_name__in=...
528+
server_port=...
529+
size=...
530+
size__gt=...
531+
size__gte=...
532+
size__lt=...
533+
size__lte=...
534+
table_name=...
535+
table_name__in=...
536+
tags=...
537+
tags__in=...
538+
type=...
539+
updated_at=...
540+
updated_at__gt=...
541+
updated_at__gte=...
542+
updated_at__lt=...
543+
updated_at__lte=...
544+
"""
545+
546+
return super().filter(*invalid, page_size=page_size, **kwargs)

tableauserverclient/server/endpoint/flow_runs_endpoint.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from tableauserverclient.exponential_backoff import ExponentialBackoffTimer
88

99
from tableauserverclient.helpers.logging import logger
10+
from tableauserverclient.server.query import QuerySet
1011

1112
if TYPE_CHECKING:
1213
from tableauserverclient.server.server import Server
@@ -78,3 +79,42 @@ def wait_for_job(self, flow_run_id: str, *, timeout: Optional[int] = None) -> Fl
7879
raise FlowRunCancelledException(flow_run)
7980
else:
8081
raise AssertionError("Unexpected status in flow_run", flow_run)
82+
83+
def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[FlowRunItem]:
84+
"""
85+
Queries the Tableau Server for items using the specified filters. Page
86+
size can be specified to limit the number of items returned in a single
87+
request. If not specified, the default page size is 100. Page size can
88+
be an integer between 1 and 1000.
89+
90+
No positional arguments are allowed. All filters must be specified as
91+
keyword arguments. If you use the equality operator, you can specify it
92+
through <field_name>=<value>. If you want to use a different operator,
93+
you can specify it through <field_name>__<operator>=<value>. Field
94+
names can either be in snake_case or camelCase.
95+
96+
This endpoint supports the following fields and operators:
97+
98+
99+
complete_at=...
100+
complete_at__gt=...
101+
complete_at__gte=...
102+
complete_at__lt=...
103+
complete_at__lte=...
104+
flow_id=...
105+
flow_id__in=...
106+
progress=...
107+
progress__gt=...
108+
progress__gte=...
109+
progress__lt=...
110+
progress__lte=...
111+
started_at=...
112+
started_at__gt=...
113+
started_at__gte=...
114+
started_at__lt=...
115+
started_at__lte=...
116+
user_id=...
117+
user_id__in=...
118+
"""
119+
120+
return super().filter(*invalid, page_size=page_size, **kwargs)

tableauserverclient/server/endpoint/flows_endpoint.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
get_file_type,
2323
get_file_object_size,
2424
)
25+
from tableauserverclient.server.query import QuerySet
2526

2627
io_types_r = (io.BytesIO, io.BufferedReader)
2728
io_types_w = (io.BytesIO, io.BufferedWriter)
@@ -295,3 +296,39 @@ def schedule_flow_run(
295296
self, schedule_id: str, item: FlowItem
296297
) -> List["AddResponse"]: # actually should return a task
297298
return self.parent_srv.schedules.add_to_schedule(s 72A8 chedule_id, flow=item)
299+
300+
def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[FlowItem]:
301+
"""
302+
Queries the Tableau Server for items using the specified filters. Page
303+
size can be specified to limit the number of items returned in a single
304+
request. If not specified, the default page size is 100. Page size can
305+
be an integer between 1 and 1000.
306+
307+
No positional arguments are allowed. All filters must be specified as
308+
keyword arguments. If you use the equality operator, you can specify it
309+
through <field_name>=<value>. If you want to use a different operator,
310+
you can specify it through <field_name>__<operator>=<value>. Field
311+
names can either be in snake_case or camelCase.
312+
313+
This endpoint supports the following fields and operators:
314+
315+
316+
created_at=...
317+
created_at__gt=...
318+
created_at__gte=...
319+
created_at__lt=...
320+
created_at__lte=...
321+
name=...
322+
name__in=...
323+
owner_name=...
324+
project_id=...
325+
project_name=...
326+
project_name__in=...
327+
updated=...
328+
updated__gt=...
329+
updated__gte=...
330+
updated__lt=...
331+
updated__lte=...
332+
"""
333+
334+
return super().filter(*invalid, page_size=page_size, **kwargs)

tableauserverclient/server/endpoint/groups_endpoint.py

Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
from typing import Iterable, List, Optional, TYPE_CHECKING, Tuple, Union
1212

13+
from tableauserverclient.server.query import QuerySet
14+
1315
if TYPE_CHECKING:
1416
from tableauserverclient.server.request_options import RequestOptions
1517

@@ -162,3 +164,42 @@ def add_users(self, group_item: GroupItem, users: Iterable[Union[str, UserItem]]
162164
users = UserItem.from_response(server_response.content, self.parent_srv.namespace)
163165
logger.info("Added users to group (ID: {0})".format(group_item.id))
164166
return users
167+
168+
def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[GroupItem]:
169+
"""
170+
Queries the Tableau Server for items using the specified filters. Page
171+
size can be specified to limit the number of items returned in a single
172+
request. If not specified, the default page size is 100. Page size can
173+
be an integer between 1 and 1000.
174+
175+
No positional arguments are allowed. All filters must be specified as
176+
keyword arguments. If you use the equality operator, you can specify it
177+
through <field_name>=<value>. If you want to use a different operator,
178+
you can specify it through <field_name>__<operator>=<value>. Field
179+
names can either be in snake_case or camelCase.
180+
181+
This endpoint supports the following fields and operators:
182+
183+
184+
domain_name=...
185+
domain_name__in=...
186+
domain_nickname=...
187+
domain_nickname__in=...
188+
is_external_user_enabled=...
189+
is_local=...
190+
luid=...
191+
luid__in=...
192+
minimum_site_role=...
193+
minimum_site_role__in=...
194+
name__cieq=...
195+
name=...
196+
name__in=...
197+
name__like=...
198+
user_count=...
199+
user_count__gt=...
200+
user_count__gte=...
201+
user_count__lt=...
202+
user_count__lte=...
203+
"""
204+
205+
return super().filter(*invalid, page_size=page_size, **kwargs)

tableauserverclient/server/endpoint/groupsets_endpoint.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from tableauserverclient.models.groupset_item import GroupSetItem
66
from tableauserverclient.models.pagination_item import PaginationItem
77
from tableauserverclient.server.endpoint.endpoint import QuerysetEndpoint
8+
from tableauserverclient.server.query import QuerySet
89
from tableauserverclient.server.request_options import RequestOptions
910
from tableauserverclient.server.request_factory import RequestFactory
1011
from tableauserverclient.server.endpoint.endpoint import api
@@ -85,3 +86,42 @@ def update(self, groupset: GroupSetItem) -> GroupSetItem:
8586
server_response = self.put_request(url, request)
8687
updated_groupset = GroupSetItem.from_response(server_response.content, self.parent_srv.namespace)
8788
return updated_groupset[0]
89+
90+
def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[GroupSetItem]:
91+
"""
92+
Queries the Tableau Server for items using the specified filters. Page
93+
size can be specified to limit the number of items returned in a single
94+
request. If not specified, the default page size is 100. Page size can
95+
be an integer between 1 and 1000.
96+
97+
No positional arguments are allowed. All filters must be specified as
98+
keyword arguments. If you use the equality operator, you can specify it
99+
through <field_name>=<value>. If you want to use a different operator,
100+
you can specify it through <field_name>__<operator>=<value>. Field
101+
names can either be in snake_case or camelCase.
102+
103+
This endpoint supports the following fields and operators:
104+
105+
106+
domain_name=...
107+
domain_name__in=...
108+
domain_nickname=...
109+
domain_nickname__in=...
110+
is_external_user_enabled=...
111+
is_local=...
112+
luid=...
113+
luid__in=...
114+
minimum_site_role=...
115+
minimum_site_role__in=...
116+
name__cieq=...
117+
name=...
118+
name__in=...
119+
name__like=...
120+
user_count=...
121+
user_count__gt=...
122+
user_count__gte=...
123+
user_count__lt=...
124+
user_count__lte=...
125+
"""
126+
127+
return super().filter(*invalid, page_size=page_size, **kwargs)

tableauserverclient/server/endpoint/jobs_endpoint.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import logging
22

3+
from tableauserverclient.server.query import QuerySet
4+
35
from .endpoint import QuerysetEndpoint, api
46
from .exceptions import JobCancelledException, JobFailedException
57
from tableauserverclient.models import JobItem, BackgroundJobItem, PaginationItem
@@ -74,3 +76,57 @@ def wait_for_job(self, job_id: Union[str, JobItem], *, timeout: Optional[float]
7476
raise JobCancelledException(job)
7577
else:
7678
raise AssertionError("Unexpected finish_code in job", job)
79+
80+
def filter(self, *invalid, page_size: Optional[int] = None, **kwargs) -> QuerySet[JobItem]:
81+
"""
82+
Queries the Tableau Server for items using the specified filters. Page
83+
size can be specified to limit the number of items returned in a single
84+
request. If not specified, the default page size is 100. Page size can
85+
be an integer between 1 and 1000.
86+
87+
No positional arguments are allowed. All filters must be specified as
88+
keyword arguments. If you use the equality operator, you can specify it
89+
through <field_name>=<value>. If you want to use a different operator,
90+
you can specify it through <field_name>__<operator>=<value>. Field
91+
names can either be in snake_case or camelCase.
92+
93+
This endpoint supports the following fields and operators:
94+
95+
96+
args__has=...
97+
completed_at=...
98+
completed_at__gt=...
99+
completed_at__gte=...
100+
completed_at__lt=...
101+
completed_at__lte=...
102+
created_at=...
103+
created_at__gt=...
104+
created_at__gte=...
105+
created_at__lt=...
106+
created_at__lte=...
107+
job_type=...
108+
job_type__in=...
109+
notes__has=...
110+
priority=...
111+
priority__gt=...
112+
priority__gte=...
113+
priority__lt=...
114+
priority__lte=...
115+
progress=...
116+
progress__gt=...
117+
progress__gte=...
118+
progress__lt=...
119+
progress__lte=...
120+
started_at=...
121+
started_at__gt=...
122+
started_at__gte=...
123+
started_at__lt=...
124+
started_at__lte=...
125+
status=...
126+
subtitle=...
127+
subtitle__has=...
128+
title=...
129+
title__has=...
130+
"""
131+
132+
return super().filter(*invalid, page_size=page_size, **kwargs)

0 commit comments

Comments
 (0)
0