|
6 | 6 |
|
7 | 7 | from contextlib import closing |
8 | 8 | from pathlib import Path |
9 | | -from typing import Literal, Optional, TYPE_CHECKING, TypeVar, Union, overload |
10 | | -from collections.abc import Iterable, Mapping, Sequence |
| 9 | +from typing import Literal, Optional, TYPE_CHECKING, TypedDict, TypeVar, Union, overload |
| 10 | +from collections.abc import Iterable, Sequence |
11 | 11 |
|
12 | 12 | from tableauserverclient.helpers.headers import fix_filename |
13 | 13 | from tableauserverclient.models.dqw_item import DQWItem |
|
56 | 56 | PathOrFileW = Union[FilePath, FileObjectW] |
57 | 57 |
|
58 | 58 |
|
| 59 | +HyperActionCondition = TypedDict( |
| 60 | + "HyperActionCondition", |
| 61 | + { |
| 62 | + "op": str, |
| 63 | + "target-col": str, |
| 64 | + "source-col": str, |
| 65 | + }, |
| 66 | +) |
| 67 | + |
| 68 | +HyperActionRow = TypedDict( |
| 69 | + "HyperActionRow", |
| 70 | + { |
| 71 | + "action": Literal[ |
| 72 | + "update", |
| 73 | + "upsert", |
| 74 | + "delete", |
| 75 | + ], |
| 76 | + "source-table": str, |
| 77 | + "target-table": str, |
| 78 | + "condition": HyperActionCondition, |
| 79 | + }, |
| 80 | +) |
| 81 | + |
| 82 | +HyperActionTable = TypedDict( |
| 83 | + "HyperActionTable", |
| 84 | + { |
| 85 | + "action": Literal[ |
| 86 | + "insert", |
| 87 | + "replace", |
| 88 | + ], |
| 89 | + "source-table": str, |
| 90 | + "target-table": str, |
| 91 | + }, |
| 92 | +) |
| 93 | + |
| 94 | +HyperAction = Union[HyperActionTable, HyperActionRow] |
| 95 | + |
| 96 | + |
59 | 97 | class Datasources(QuerysetEndpoint[DatasourceItem], TaggingMixin[DatasourceItem]): |
60 | 98 | def __init__(self, parent_srv: "Server") -> None: |
61 | 99 | super().__init__(parent_srv) |
@@ -648,7 +686,7 @@ def update_hyper_data( |
648 | 686 | datasource_or_connection_item: Union[DatasourceItem, ConnectionItem, str], |
649 | 687 | *, |
650 | 688 | request_id: str, |
651 | | - actions: Sequence[Mapping], |
| 689 | + actions: Sequence[HyperAction], |
652 | 690 | payload: Optional[FilePath] = None, |
653 | 691 | ) -> JobItem: |
654 | 692 | """ |
|
0 commit comments