dasl-client 1.0.9__tar.gz → 1.0.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dasl-client might be problematic. Click here for more details.
- {dasl_client-1.0.9 → dasl_client-1.0.12}/PKG-INFO +2 -2
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/auth/auth.py +6 -5
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/client.py +37 -1
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/types/__init__.py +1 -0
- dasl_client-1.0.12/dasl_client/types/content.py +243 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/types/rule.py +41 -11
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/types/workspace_config.py +4 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client.egg-info/PKG-INFO +2 -2
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client.egg-info/SOURCES.txt +1 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client.egg-info/requires.txt +1 -1
- {dasl_client-1.0.9 → dasl_client-1.0.12}/pyproject.toml +2 -2
- {dasl_client-1.0.9 → dasl_client-1.0.12}/test/test_api_changes.py +1 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/test/test_marshaling.py +2 -2
- {dasl_client-1.0.9 → dasl_client-1.0.12}/LICENSE +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/README.md +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/__init__.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/auth/__init__.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/conn/__init__.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/conn/client_identifier.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/conn/conn.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/errors/__init__.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/errors/errors.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/helpers.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/preset_development/__init__.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/preset_development/errors.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/preset_development/preview_engine.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/preset_development/preview_parameters.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/preset_development/stage.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/types/admin_config.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/types/datasource.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/types/dbui.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/types/helpers.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/types/types.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client.egg-info/dependency_links.txt +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client.egg-info/top_level.txt +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/setup.cfg +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/setup.py +0 -0
- {dasl_client-1.0.9 → dasl_client-1.0.12}/test/test_api_surface.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dasl_client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.12
|
|
4
4
|
Summary: The DASL client library used for interacting with the DASL workspace
|
|
5
5
|
Home-page: https://github.com/antimatter/asl
|
|
6
6
|
Author: Antimatter Team
|
|
@@ -8,7 +8,7 @@ Author-email: Antimatter Team <support@antimatter.io>
|
|
|
8
8
|
Requires-Python: >=3.8
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Requires-Dist: dasl_api==0.1.
|
|
11
|
+
Requires-Dist: dasl_api==0.1.15
|
|
12
12
|
Requires-Dist: databricks-sdk>=0.41.0
|
|
13
13
|
Requires-Dist: pydantic>=2
|
|
14
14
|
Requires-Dist: typing_extensions==4.10.0
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import abc
|
|
2
|
+
import base64
|
|
2
3
|
import time
|
|
3
4
|
from datetime import datetime
|
|
4
5
|
|
|
@@ -176,15 +177,15 @@ class DatabricksSecretAuth(Authorization):
|
|
|
176
177
|
principalName=self._principal,
|
|
177
178
|
)
|
|
178
179
|
handler = api.WorkspaceV1Api(api_client=self._client)
|
|
179
|
-
resp = handler.
|
|
180
|
-
workspace=self._workspace,
|
|
180
|
+
resp = handler.workspace_v1_request_secret(
|
|
181
|
+
workspace=self._workspace, workspace_v1_request_secret_request=req
|
|
181
182
|
)
|
|
182
183
|
secret_name = resp.secret_name
|
|
183
184
|
secret_value = ""
|
|
184
185
|
for tries in range(3):
|
|
185
186
|
try:
|
|
186
|
-
secret_value =
|
|
187
|
-
secret_name, "token"
|
|
187
|
+
secret_value = (
|
|
188
|
+
WorkspaceClient().secrets.get_secret(secret_name, "token").value
|
|
188
189
|
)
|
|
189
190
|
break
|
|
190
191
|
except ResourceDoesNotExist:
|
|
@@ -194,7 +195,7 @@ class DatabricksSecretAuth(Authorization):
|
|
|
194
195
|
raise RuntimeError(f"failed to complete secret auth")
|
|
195
196
|
|
|
196
197
|
req = WorkspaceV1AuthenticateRequest(
|
|
197
|
-
databricks_secret=secret_value,
|
|
198
|
+
databricks_secret=base64.b64decode(secret_value).decode("utf-8"),
|
|
198
199
|
)
|
|
199
200
|
handler = api.WorkspaceV1Api(api_client=self._client)
|
|
200
201
|
|
|
@@ -3,8 +3,8 @@ from typing import Any, Callable, Iterator, List, Optional, TypeVar
|
|
|
3
3
|
|
|
4
4
|
from dasl_api import (
|
|
5
5
|
CoreV1Api,
|
|
6
|
-
CoreV1DataSourceAutoloaderSpec,
|
|
7
6
|
DbuiV1Api,
|
|
7
|
+
ContentV1Api,
|
|
8
8
|
WorkspaceV1Api,
|
|
9
9
|
WorkspaceV1CreateWorkspaceRequest,
|
|
10
10
|
api,
|
|
@@ -13,6 +13,7 @@ from pydantic import Field
|
|
|
13
13
|
|
|
14
14
|
from dasl_client.auth.auth import (
|
|
15
15
|
Authorization,
|
|
16
|
+
DatabricksSecretAuth,
|
|
16
17
|
DatabricksTokenAuth,
|
|
17
18
|
ServiceAccountKeyAuth,
|
|
18
19
|
)
|
|
@@ -29,6 +30,8 @@ from .types import (
|
|
|
29
30
|
WorkspaceConfig,
|
|
30
31
|
TransformRequest,
|
|
31
32
|
TransformResponse,
|
|
33
|
+
DataSourcePresetsList,
|
|
34
|
+
DataSourcePreset,
|
|
32
35
|
)
|
|
33
36
|
|
|
34
37
|
|
|
@@ -229,6 +232,9 @@ class Client:
|
|
|
229
232
|
def _dbui_client(self) -> DbuiV1Api:
|
|
230
233
|
return DbuiV1Api(self.auth.client())
|
|
231
234
|
|
|
235
|
+
def _content_client(self) -> ContentV1Api:
|
|
236
|
+
return ContentV1Api(self.auth.client())
|
|
237
|
+
|
|
232
238
|
def _workspace(self) -> str:
|
|
233
239
|
return self.auth.workspace()
|
|
234
240
|
|
|
@@ -616,3 +622,33 @@ class Client:
|
|
|
616
622
|
limit=limit,
|
|
617
623
|
)
|
|
618
624
|
)
|
|
625
|
+
|
|
626
|
+
def list_presets(self) -> DataSourcePresetsList:
|
|
627
|
+
"""
|
|
628
|
+
List the Presets in this workspace. This will include any user defined
|
|
629
|
+
presets if a custom presets path has been configured in the workspace.
|
|
630
|
+
|
|
631
|
+
:returns: DataSourcePresetsList
|
|
632
|
+
"""
|
|
633
|
+
with error_handler():
|
|
634
|
+
return DataSourcePresetsList.from_api_obj(
|
|
635
|
+
self._content_client().content_v1_get_preset_data_sources(
|
|
636
|
+
self._workspace(),
|
|
637
|
+
)
|
|
638
|
+
)
|
|
639
|
+
|
|
640
|
+
def get_preset(self, name: str) -> DataSourcePreset:
|
|
641
|
+
"""
|
|
642
|
+
Get the preset with the argument name from the DASL server. If the preset name
|
|
643
|
+
begins with 'internal_' it will instead be collected from the user catalog,
|
|
644
|
+
provided a preset path is set in the workspace config.
|
|
645
|
+
|
|
646
|
+
:param name: The unique name of the DataSource preset within this workspace.
|
|
647
|
+
:returns: DataSourcePreset
|
|
648
|
+
"""
|
|
649
|
+
with error_handler():
|
|
650
|
+
return DataSourcePreset.from_api_obj(
|
|
651
|
+
self._content_client().content_v1_get_preset_datasource(
|
|
652
|
+
self._workspace(), name
|
|
653
|
+
)
|
|
654
|
+
)
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
from typing import Optional, List, Dict
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
|
|
4
|
+
from dasl_api import (
|
|
5
|
+
ContentV1PresetDataSourceList,
|
|
6
|
+
ContentV1PresetDataSourceListItemsInner,
|
|
7
|
+
ContentV1DatasourcePresetAutoloader,
|
|
8
|
+
ContentV1DatasourcePresetSilver,
|
|
9
|
+
ContentV1DatasourcePresetSilverPreTransformInner,
|
|
10
|
+
ContentV1DatasourcePresetSilverTransformInner,
|
|
11
|
+
ContentV1DatasourcePresetGoldInner,
|
|
12
|
+
ContentV1DatasourcePreset,
|
|
13
|
+
ContentV1DatasourcePresetAutoloaderCloudFiles,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
from .datasource import DataSource, FieldSpec, FieldUtils
|
|
17
|
+
from .helpers import Helpers
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class SilverPreset(BaseModel):
|
|
21
|
+
class PreTransform(BaseModel):
|
|
22
|
+
name: Optional[str] = None
|
|
23
|
+
filter: Optional[str] = None
|
|
24
|
+
post_filter: Optional[str] = None
|
|
25
|
+
fields: Optional[List[Optional[FieldSpec]]] = None
|
|
26
|
+
utils: Optional[FieldUtils] = None
|
|
27
|
+
|
|
28
|
+
@staticmethod
|
|
29
|
+
def from_api_obj(
|
|
30
|
+
obj: Optional[ContentV1DatasourcePresetSilverPreTransformInner],
|
|
31
|
+
) -> Optional["SilverPreset.PreTransform"]:
|
|
32
|
+
if obj is None:
|
|
33
|
+
return None
|
|
34
|
+
if obj.fields is not None:
|
|
35
|
+
fields = [FieldSpec.from_api_obj(item) for item in obj.fields]
|
|
36
|
+
else:
|
|
37
|
+
fields = None
|
|
38
|
+
|
|
39
|
+
return SilverPreset.PreTransform(
|
|
40
|
+
name=obj.name,
|
|
41
|
+
filter=obj.filter,
|
|
42
|
+
post_filter=obj.post_filter,
|
|
43
|
+
fields=fields,
|
|
44
|
+
utils=FieldUtils.from_api_obj(obj.utils),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
class Transform(BaseModel):
|
|
48
|
+
name: Optional[str] = None
|
|
49
|
+
filter: Optional[str] = None
|
|
50
|
+
post_filter: Optional[str] = None
|
|
51
|
+
fields: Optional[List[Optional[FieldSpec]]] = None
|
|
52
|
+
utils: Optional[FieldUtils] = None
|
|
53
|
+
|
|
54
|
+
@staticmethod
|
|
55
|
+
def from_api_obj(
|
|
56
|
+
obj: Optional[ContentV1DatasourcePresetSilverTransformInner],
|
|
57
|
+
) -> Optional["SilverPreset.Transform"]:
|
|
58
|
+
if obj is None:
|
|
59
|
+
return None
|
|
60
|
+
if obj.fields is not None:
|
|
61
|
+
fields = [FieldSpec.from_api_obj(item) for item in obj.fields]
|
|
62
|
+
else:
|
|
63
|
+
fields = None
|
|
64
|
+
|
|
65
|
+
return SilverPreset.Transform(
|
|
66
|
+
name=obj.name,
|
|
67
|
+
filter=obj.filter,
|
|
68
|
+
post_filter=obj.post_filter,
|
|
69
|
+
fields=fields,
|
|
70
|
+
utils=FieldUtils.from_api_obj(obj.utils),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
pre_transform: Optional[List[PreTransform]] = None
|
|
74
|
+
transform: Optional[List[Transform]] = None
|
|
75
|
+
|
|
76
|
+
@staticmethod
|
|
77
|
+
def from_api_obj(
|
|
78
|
+
obj: Optional[ContentV1DatasourcePresetSilver],
|
|
79
|
+
) -> Optional["SilverPreset"]:
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if obj.pre_transform is not None:
|
|
84
|
+
pre_transform = [
|
|
85
|
+
SilverPreset.PreTransform.from_api_obj(item)
|
|
86
|
+
for item in obj.pre_transform
|
|
87
|
+
]
|
|
88
|
+
else:
|
|
89
|
+
pre_transform = None
|
|
90
|
+
|
|
91
|
+
if obj.transform is not None:
|
|
92
|
+
transform = [
|
|
93
|
+
SilverPreset.Transform.from_api_obj(item) for item in obj.transform
|
|
94
|
+
]
|
|
95
|
+
else:
|
|
96
|
+
transform = None
|
|
97
|
+
|
|
98
|
+
return SilverPreset(
|
|
99
|
+
pre_transform=pre_transform,
|
|
100
|
+
transform=transform,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class GoldPreset(BaseModel):
|
|
105
|
+
name: str
|
|
106
|
+
input: str
|
|
107
|
+
filter: Optional[str] = None
|
|
108
|
+
post_filter: Optional[str] = None
|
|
109
|
+
fields: Optional[List[Optional[FieldSpec]]] = None
|
|
110
|
+
utils: Optional[FieldUtils] = None
|
|
111
|
+
|
|
112
|
+
@staticmethod
|
|
113
|
+
def from_api_obj(
|
|
114
|
+
obj: Optional[ContentV1DatasourcePresetGoldInner],
|
|
115
|
+
) -> Optional["GoldPreset"]:
|
|
116
|
+
if obj is None:
|
|
117
|
+
return None
|
|
118
|
+
if obj.fields is not None:
|
|
119
|
+
fields = [FieldSpec.from_api_obj(item) for item in obj.fields]
|
|
120
|
+
else:
|
|
121
|
+
fields = None
|
|
122
|
+
|
|
123
|
+
return GoldPreset(
|
|
124
|
+
name=obj.name,
|
|
125
|
+
input=obj.input,
|
|
126
|
+
filter=obj.filter,
|
|
127
|
+
post_filter=obj.post_filter,
|
|
128
|
+
fields=fields,
|
|
129
|
+
utils=FieldUtils.from_api_obj(obj.utils),
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class PresetCloudFiles(BaseModel):
|
|
134
|
+
schema_hints_file: Optional[str] = None
|
|
135
|
+
schema_hints: Optional[str] = None
|
|
136
|
+
|
|
137
|
+
@staticmethod
|
|
138
|
+
def from_api_obj(
|
|
139
|
+
obj: Optional[ContentV1DatasourcePresetAutoloaderCloudFiles],
|
|
140
|
+
) -> Optional["PresetCloudFiles"]:
|
|
141
|
+
if obj is None:
|
|
142
|
+
return None
|
|
143
|
+
|
|
144
|
+
return PresetCloudFiles(
|
|
145
|
+
schema_hints_file=obj.schema_hints_file,
|
|
146
|
+
schema_hints=obj.schema_hints,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class PresetAutoloader(BaseModel):
|
|
151
|
+
format: str
|
|
152
|
+
schema_file: Optional[str] = None
|
|
153
|
+
var_schema: Optional[str] = None
|
|
154
|
+
cloud_files: Optional[PresetCloudFiles] = None
|
|
155
|
+
|
|
156
|
+
@staticmethod
|
|
157
|
+
def from_api_obj(
|
|
158
|
+
obj: Optional[ContentV1DatasourcePresetAutoloader],
|
|
159
|
+
) -> Optional["PresetAutoloader"]:
|
|
160
|
+
if obj is None:
|
|
161
|
+
return None
|
|
162
|
+
|
|
163
|
+
return PresetAutoloader(
|
|
164
|
+
format=obj.format,
|
|
165
|
+
schema_file=obj.schema_file,
|
|
166
|
+
var_schema=obj.var_schema,
|
|
167
|
+
cloud_files=PresetCloudFiles.from_api_obj(obj.cloud_files),
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class DataSourcePreset(BaseModel):
|
|
172
|
+
|
|
173
|
+
name: Optional[str] = None
|
|
174
|
+
author: Optional[str] = None
|
|
175
|
+
description: Optional[str] = None
|
|
176
|
+
autoloader: Optional[PresetAutoloader] = None
|
|
177
|
+
silver: Optional[SilverPreset] = None
|
|
178
|
+
gold: Optional[List[GoldPreset]] = None
|
|
179
|
+
|
|
180
|
+
@staticmethod
|
|
181
|
+
def from_api_obj(
|
|
182
|
+
obj: Optional[ContentV1DatasourcePreset],
|
|
183
|
+
) -> Optional["DataSourcePreset"]:
|
|
184
|
+
if obj is None:
|
|
185
|
+
return None
|
|
186
|
+
|
|
187
|
+
return DataSourcePreset(
|
|
188
|
+
name=obj.name,
|
|
189
|
+
author=obj.author,
|
|
190
|
+
description=obj.description,
|
|
191
|
+
autoloader=PresetAutoloader.from_api_obj(obj.autoloader),
|
|
192
|
+
silver=SilverPreset.from_api_obj(obj.silver),
|
|
193
|
+
gold=[GoldPreset.from_api_obj(item) for item in obj.gold],
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class DataSourcePresetSummary(BaseModel):
|
|
198
|
+
name: Optional[str] = None
|
|
199
|
+
source: Optional[str] = None
|
|
200
|
+
source_type: Optional[str] = None
|
|
201
|
+
description: Optional[str] = None
|
|
202
|
+
title: Optional[str] = None
|
|
203
|
+
author: Optional[str] = None
|
|
204
|
+
icon_url: Optional[str] = None
|
|
205
|
+
|
|
206
|
+
@staticmethod
|
|
207
|
+
def from_api_obj(
|
|
208
|
+
obj: Optional[ContentV1PresetDataSourceListItemsInner],
|
|
209
|
+
) -> Optional["DataSourcePresetSummary"]:
|
|
210
|
+
if obj is None:
|
|
211
|
+
return None
|
|
212
|
+
|
|
213
|
+
return DataSourcePresetSummary(
|
|
214
|
+
name=obj.name,
|
|
215
|
+
source=obj.source,
|
|
216
|
+
source_type=obj.source_type,
|
|
217
|
+
description=obj.description,
|
|
218
|
+
title=obj.title,
|
|
219
|
+
author=obj.author,
|
|
220
|
+
icon_url=obj.icon_url,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class DataSourcePresetsList(BaseModel):
|
|
225
|
+
kind: Optional[str] = None
|
|
226
|
+
cursor: Optional[str] = None
|
|
227
|
+
items: List["DataSourcePresetSummary"] = []
|
|
228
|
+
|
|
229
|
+
@staticmethod
|
|
230
|
+
def from_api_obj(
|
|
231
|
+
obj: Optional[ContentV1PresetDataSourceList],
|
|
232
|
+
) -> Optional["DataSourcePresetsList"]:
|
|
233
|
+
if obj is None:
|
|
234
|
+
return None
|
|
235
|
+
cursor = None
|
|
236
|
+
if obj.metadata is not None:
|
|
237
|
+
cursor = obj.metadata.cursor
|
|
238
|
+
|
|
239
|
+
return DataSourcePresetsList(
|
|
240
|
+
kind=obj.kind,
|
|
241
|
+
cursor=cursor,
|
|
242
|
+
items=[DataSourcePresetSummary.from_api_obj(item) for item in obj.items],
|
|
243
|
+
)
|
|
@@ -17,7 +17,7 @@ from dasl_api import (
|
|
|
17
17
|
CoreV1RuleObservable,
|
|
18
18
|
CoreV1RuleObservableRisk,
|
|
19
19
|
CoreV1RuleSpecOutput,
|
|
20
|
-
CoreV1RuleSpecCollate,
|
|
20
|
+
CoreV1RuleSpecCollate, CoreV1RuleSpecInputBatchCustom,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
from .helpers import Helpers
|
|
@@ -251,9 +251,9 @@ class Rule(BaseModel):
|
|
|
251
251
|
Input if the rule should operate on batched input data.
|
|
252
252
|
"""
|
|
253
253
|
|
|
254
|
-
class
|
|
254
|
+
class CustomStream(BaseModel):
|
|
255
255
|
"""
|
|
256
|
-
Specification of a custom notebook for generating input to
|
|
256
|
+
Specification of a stream custom notebook for generating input to
|
|
257
257
|
the Rule.
|
|
258
258
|
|
|
259
259
|
Attributes:
|
|
@@ -267,10 +267,10 @@ class Rule(BaseModel):
|
|
|
267
267
|
@staticmethod
|
|
268
268
|
def from_api_obj(
|
|
269
269
|
obj: Optional[CoreV1RuleSpecInputStreamCustom],
|
|
270
|
-
) -> "Rule.Input.
|
|
270
|
+
) -> "Rule.Input.CustomStream":
|
|
271
271
|
if obj is None:
|
|
272
272
|
return None
|
|
273
|
-
return Rule.Input.
|
|
273
|
+
return Rule.Input.CustomStream(
|
|
274
274
|
notebook=obj.notebook,
|
|
275
275
|
options=obj.options,
|
|
276
276
|
)
|
|
@@ -281,6 +281,36 @@ class Rule(BaseModel):
|
|
|
281
281
|
options=self.options,
|
|
282
282
|
)
|
|
283
283
|
|
|
284
|
+
class CustomBatch(BaseModel):
|
|
285
|
+
"""
|
|
286
|
+
Specification of a batch custom notebook for generating input to
|
|
287
|
+
the Rule.
|
|
288
|
+
|
|
289
|
+
Attributes:
|
|
290
|
+
notebook (Optional[str]):
|
|
291
|
+
options (Optional[Dict[str, str]]):
|
|
292
|
+
"""
|
|
293
|
+
|
|
294
|
+
notebook: Optional[str] = None
|
|
295
|
+
options: Optional[Dict[str, str]] = None
|
|
296
|
+
|
|
297
|
+
@staticmethod
|
|
298
|
+
def from_api_obj(
|
|
299
|
+
obj: Optional[CoreV1RuleSpecInputBatchCustom],
|
|
300
|
+
) -> "Rule.Input.CustomBatch":
|
|
301
|
+
if obj is None:
|
|
302
|
+
return None
|
|
303
|
+
return Rule.Input.CustomBatch(
|
|
304
|
+
notebook=obj.notebook,
|
|
305
|
+
options=obj.options,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
def to_api_obj(self) -> CoreV1RuleSpecInputBatchCustom:
|
|
309
|
+
return CoreV1RuleSpecInputBatchCustom(
|
|
310
|
+
notebook=self.notebook,
|
|
311
|
+
options=self.options,
|
|
312
|
+
)
|
|
313
|
+
|
|
284
314
|
class Stream(BaseModel):
|
|
285
315
|
"""
|
|
286
316
|
Specification for streaming input from a table or tables,
|
|
@@ -290,7 +320,7 @@ class Rule(BaseModel):
|
|
|
290
320
|
tables (Optional[List[Rule.Input.Stream.Table]]):
|
|
291
321
|
filter (Optional[str]):
|
|
292
322
|
sql (Optional[str]):
|
|
293
|
-
custom (Optional[Rule.Input.
|
|
323
|
+
custom (Optional[Rule.Input.CustomStream]):
|
|
294
324
|
"""
|
|
295
325
|
|
|
296
326
|
class Table(BaseModel):
|
|
@@ -395,7 +425,7 @@ class Rule(BaseModel):
|
|
|
395
425
|
tables: Optional[List["Rule.Input.Stream.Table"]] = None
|
|
396
426
|
filter: Optional[str] = None
|
|
397
427
|
sql: Optional[str] = None
|
|
398
|
-
custom: Optional["Rule.Input.
|
|
428
|
+
custom: Optional["Rule.Input.CustomStream"] = None
|
|
399
429
|
|
|
400
430
|
@staticmethod
|
|
401
431
|
def from_api_obj(
|
|
@@ -413,7 +443,7 @@ class Rule(BaseModel):
|
|
|
413
443
|
tables=tables,
|
|
414
444
|
filter=obj.filter,
|
|
415
445
|
sql=obj.sql,
|
|
416
|
-
custom=Rule.Input.
|
|
446
|
+
custom=Rule.Input.CustomStream.from_api_obj(obj.custom),
|
|
417
447
|
)
|
|
418
448
|
|
|
419
449
|
def to_api_obj(self) -> CoreV1RuleSpecInputStream:
|
|
@@ -434,11 +464,11 @@ class Rule(BaseModel):
|
|
|
434
464
|
|
|
435
465
|
Attributes:
|
|
436
466
|
sql (Optional[str]):
|
|
437
|
-
custom (Optional[Rule.Input.
|
|
467
|
+
custom (Optional[Rule.Input.CustomBatch]):
|
|
438
468
|
"""
|
|
439
469
|
|
|
440
470
|
sql: Optional[str] = None
|
|
441
|
-
custom: Optional["Rule.Input.
|
|
471
|
+
custom: Optional["Rule.Input.CustomBatch"] = None
|
|
442
472
|
|
|
443
473
|
@staticmethod
|
|
444
474
|
def from_api_obj(
|
|
@@ -448,7 +478,7 @@ class Rule(BaseModel):
|
|
|
448
478
|
return None
|
|
449
479
|
return Rule.Input.Batch(
|
|
450
480
|
sql=obj.sql,
|
|
451
|
-
custom=Rule.Input.
|
|
481
|
+
custom=Rule.Input.CustomBatch.from_api_obj(obj.custom),
|
|
452
482
|
)
|
|
453
483
|
|
|
454
484
|
def to_api_obj(self) -> CoreV1RuleSpecInputBatch:
|
|
@@ -576,6 +576,8 @@ class WorkspaceConfig(BaseModel):
|
|
|
576
576
|
dasl_storage_path (Optional[str]):
|
|
577
577
|
The path to a directory where DASL can store internal files and
|
|
578
578
|
state.
|
|
579
|
+
dasl_custom_presets_path (Optional[str]):
|
|
580
|
+
An optional path to a directory containing user defined presets.
|
|
579
581
|
default_config (Optional[DefaultConfig]):
|
|
580
582
|
Configuration settings regarding storage of bronze, silver, and
|
|
581
583
|
gold tables and related assets for each resource type.
|
|
@@ -594,6 +596,7 @@ class WorkspaceConfig(BaseModel):
|
|
|
594
596
|
operational_alert_export: Optional[ExportConfig] = None
|
|
595
597
|
observables: Optional[WorkspaceConfigObservables] = None
|
|
596
598
|
dasl_storage_path: Optional[str] = None
|
|
599
|
+
dasl_custom_presets_path: Optional[str] = None
|
|
597
600
|
default_config: Optional[DefaultConfig] = None
|
|
598
601
|
managed_retention: Optional[List[ManagedRetention]] = None
|
|
599
602
|
status: Optional[ResourceStatus] = None
|
|
@@ -623,6 +626,7 @@ class WorkspaceConfig(BaseModel):
|
|
|
623
626
|
),
|
|
624
627
|
observables=WorkspaceConfigObservables.from_api_obj(spec.observables),
|
|
625
628
|
dasl_storage_path=spec.dasl_storage_path,
|
|
629
|
+
dasl_custom_presets_path=spec.dasl_custom_presets_path,
|
|
626
630
|
default_config=DefaultConfig.from_api_obj(spec.default_config),
|
|
627
631
|
managed_retention=managed_retention,
|
|
628
632
|
status=ResourceStatus.from_api_obj(obj.status),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dasl_client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.12
|
|
4
4
|
Summary: The DASL client library used for interacting with the DASL workspace
|
|
5
5
|
Home-page: https://github.com/antimatter/asl
|
|
6
6
|
Author: Antimatter Team
|
|
@@ -8,7 +8,7 @@ Author-email: Antimatter Team <support@antimatter.io>
|
|
|
8
8
|
Requires-Python: >=3.8
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Requires-Dist: dasl_api==0.1.
|
|
11
|
+
Requires-Dist: dasl_api==0.1.15
|
|
12
12
|
Requires-Dist: databricks-sdk>=0.41.0
|
|
13
13
|
Requires-Dist: pydantic>=2
|
|
14
14
|
Requires-Dist: typing_extensions==4.10.0
|
|
@@ -24,6 +24,7 @@ dasl_client/preset_development/preview_parameters.py
|
|
|
24
24
|
dasl_client/preset_development/stage.py
|
|
25
25
|
dasl_client/types/__init__.py
|
|
26
26
|
dasl_client/types/admin_config.py
|
|
27
|
+
dasl_client/types/content.py
|
|
27
28
|
dasl_client/types/datasource.py
|
|
28
29
|
dasl_client/types/dbui.py
|
|
29
30
|
dasl_client/types/helpers.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dasl_client"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.12"
|
|
8
8
|
description = "The DASL client library used for interacting with the DASL workspace"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -13,7 +13,7 @@ authors = [
|
|
|
13
13
|
requires-python = ">=3.8"
|
|
14
14
|
|
|
15
15
|
dependencies = [
|
|
16
|
-
"dasl_api==0.1.
|
|
16
|
+
"dasl_api==0.1.15",
|
|
17
17
|
"databricks-sdk>=0.41.0",
|
|
18
18
|
"pydantic>=2",
|
|
19
19
|
"typing_extensions==4.10.0"
|
|
@@ -18,6 +18,7 @@ checked_dasl_types = {
|
|
|
18
18
|
CoreV1DataSource: "data_source.json",
|
|
19
19
|
CoreV1Rule: "rule.json",
|
|
20
20
|
WorkspaceV1WorkspaceConfig: "workspace_config.json",
|
|
21
|
+
ContentV1DatasourcePreset: "datasource_preset.json",
|
|
21
22
|
# Data
|
|
22
23
|
DbuiV1ObservableEventsList: "observable_events_list.json",
|
|
23
24
|
}
|
|
@@ -613,14 +613,14 @@ def test_rule_marshal_unmarshal():
|
|
|
613
613
|
],
|
|
614
614
|
filter="status = 'active'",
|
|
615
615
|
sql="SELECT * FROM streaming_source",
|
|
616
|
-
custom=Rule.Input.
|
|
616
|
+
custom=Rule.Input.CustomStream(
|
|
617
617
|
notebook="stream_custom.ipynb",
|
|
618
618
|
options={"filter": "recent", "limit": "1000"},
|
|
619
619
|
),
|
|
620
620
|
),
|
|
621
621
|
batch=Rule.Input.Batch(
|
|
622
622
|
sql="SELECT * FROM historical_source",
|
|
623
|
-
custom=Rule.Input.
|
|
623
|
+
custom=Rule.Input.CustomBatch(
|
|
624
624
|
notebook="batch_custom.ipynb",
|
|
625
625
|
options={"start_date": "2022-01-01", "end_date": "2022-12-31"},
|
|
626
626
|
),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dasl_client-1.0.9 → dasl_client-1.0.12}/dasl_client/preset_development/preview_parameters.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|