acryl-datahub 0.15.0.1rc13__py3-none-any.whl → 0.15.0.1rc15__py3-none-any.whl
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 acryl-datahub might be problematic. Click here for more details.
- {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/METADATA +2413 -2413
- {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/RECORD +33 -30
- {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/WHEEL +1 -1
- datahub/__init__.py +1 -1
- datahub/emitter/mce_builder.py +3 -3
- datahub/emitter/mcp_patch_builder.py +36 -12
- datahub/ingestion/source/bigquery_v2/bigquery.py +10 -18
- datahub/ingestion/source/bigquery_v2/bigquery_config.py +3 -9
- datahub/ingestion/source/bigquery_v2/bigquery_schema_gen.py +11 -17
- datahub/ingestion/source/bigquery_v2/lineage.py +9 -22
- datahub/ingestion/source/gc/datahub_gc.py +3 -0
- datahub/ingestion/source/gc/execution_request_cleanup.py +13 -5
- datahub/ingestion/source/gc/soft_deleted_entity_cleanup.py +28 -21
- datahub/ingestion/source/snowflake/snowflake_queries.py +6 -4
- datahub/ingestion/source/tableau/tableau.py +53 -18
- datahub/ingestion/source/tableau/tableau_common.py +18 -0
- datahub/ingestion/source/usage/usage_common.py +15 -1
- datahub/specific/aspect_helpers/__init__.py +0 -0
- datahub/specific/aspect_helpers/custom_properties.py +79 -0
- datahub/specific/aspect_helpers/ownership.py +67 -0
- datahub/specific/aspect_helpers/structured_properties.py +72 -0
- datahub/specific/aspect_helpers/tags.py +42 -0
- datahub/specific/aspect_helpers/terms.py +43 -0
- datahub/specific/chart.py +28 -184
- datahub/specific/dashboard.py +31 -196
- datahub/specific/datajob.py +34 -189
- datahub/specific/dataproduct.py +24 -86
- datahub/specific/dataset.py +48 -133
- datahub/specific/form.py +12 -32
- datahub/specific/structured_property.py +9 -9
- datahub/sql_parsing/sql_parsing_aggregator.py +1 -3
- datahub/specific/custom_properties.py +0 -37
- datahub/specific/ownership.py +0 -48
- datahub/specific/structured_properties.py +0 -53
- {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/entry_points.txt +0 -0
- {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/top_level.txt +0 -0
datahub/specific/chart.py
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import List, Optional, Tuple, Union
|
|
2
2
|
|
|
3
|
-
from datahub.emitter.mcp_patch_builder import MetadataPatchProposal
|
|
3
|
+
from datahub.emitter.mcp_patch_builder import MetadataPatchProposal, PatchPath
|
|
4
4
|
from datahub.metadata.schema_classes import (
|
|
5
5
|
AccessLevelClass,
|
|
6
6
|
ChangeAuditStampsClass,
|
|
7
7
|
ChartInfoClass as ChartInfo,
|
|
8
8
|
ChartTypeClass,
|
|
9
9
|
EdgeClass as Edge,
|
|
10
|
-
GlobalTagsClass as GlobalTags,
|
|
11
|
-
GlossaryTermAssociationClass as Term,
|
|
12
|
-
GlossaryTermsClass as GlossaryTerms,
|
|
13
10
|
KafkaAuditHeaderClass,
|
|
14
|
-
OwnerClass as Owner,
|
|
15
|
-
OwnershipTypeClass,
|
|
16
11
|
SystemMetadataClass,
|
|
17
|
-
TagAssociationClass as Tag,
|
|
18
12
|
)
|
|
19
|
-
from datahub.specific.custom_properties import
|
|
20
|
-
from datahub.specific.ownership import
|
|
21
|
-
from datahub.
|
|
13
|
+
from datahub.specific.aspect_helpers.custom_properties import HasCustomPropertiesPatch
|
|
14
|
+
from datahub.specific.aspect_helpers.ownership import HasOwnershipPatch
|
|
15
|
+
from datahub.specific.aspect_helpers.tags import HasTagsPatch
|
|
16
|
+
from datahub.specific.aspect_helpers.terms import HasTermsPatch
|
|
22
17
|
from datahub.utilities.urns.urn import Urn
|
|
23
18
|
|
|
24
19
|
|
|
25
|
-
class ChartPatchBuilder(
|
|
20
|
+
class ChartPatchBuilder(
|
|
21
|
+
HasOwnershipPatch,
|
|
22
|
+
HasCustomPropertiesPatch,
|
|
23
|
+
HasTagsPatch,
|
|
24
|
+
HasTermsPatch,
|
|
25
|
+
MetadataPatchProposal,
|
|
26
|
+
):
|
|
26
27
|
def __init__(
|
|
27
28
|
self,
|
|
28
29
|
urn: str,
|
|
@@ -40,55 +41,10 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
40
41
|
super().__init__(
|
|
41
42
|
urn, system_metadata=system_metadata, audit_header=audit_header
|
|
42
43
|
)
|
|
43
|
-
self.custom_properties_patch_helper = CustomPropertiesPatchHelper(
|
|
44
|
-
self, ChartInfo.ASPECT_NAME
|
|
45
|
-
)
|
|
46
|
-
self.ownership_patch_helper = OwnershipPatchHelper(self)
|
|
47
|
-
|
|
48
|
-
def add_owner(self, owner: Owner) -> "ChartPatchBuilder":
|
|
49
|
-
"""
|
|
50
|
-
Adds an owner to the ChartPatchBuilder.
|
|
51
|
-
|
|
52
|
-
Args:
|
|
53
|
-
owner: The Owner object to add.
|
|
54
|
-
|
|
55
|
-
Returns:
|
|
56
|
-
The ChartPatchBuilder instance.
|
|
57
|
-
"""
|
|
58
|
-
self.ownership_patch_helper.add_owner(owner)
|
|
59
|
-
return self
|
|
60
44
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"""
|
|
65
|
-
Removes an owner from the ChartPatchBuilder.
|
|
66
|
-
|
|
67
|
-
Args:
|
|
68
|
-
owner: The owner to remove.
|
|
69
|
-
owner_type: The ownership type of the owner (optional).
|
|
70
|
-
|
|
71
|
-
Returns:
|
|
72
|
-
The ChartPatchBuilder instance.
|
|
73
|
-
|
|
74
|
-
Notes:
|
|
75
|
-
`owner_type` is optional.
|
|
76
|
-
"""
|
|
77
|
-
self.ownership_patch_helper.remove_owner(owner, owner_type)
|
|
78
|
-
return self
|
|
79
|
-
|
|
80
|
-
def set_owners(self, owners: List[Owner]) -> "ChartPatchBuilder":
|
|
81
|
-
"""
|
|
82
|
-
Sets the owners of the ChartPatchBuilder.
|
|
83
|
-
|
|
84
|
-
Args:
|
|
85
|
-
owners: A list of Owner objects.
|
|
86
|
-
|
|
87
|
-
Returns:
|
|
88
|
-
The ChartPatchBuilder instance.
|
|
89
|
-
"""
|
|
90
|
-
self.ownership_patch_helper.set_owners(owners)
|
|
91
|
-
return self
|
|
45
|
+
@classmethod
|
|
46
|
+
def _custom_properties_location(cls) -> Tuple[str, PatchPath]:
|
|
47
|
+
return ChartInfo.ASPECT_NAME, ("customProperties",)
|
|
92
48
|
|
|
93
49
|
def add_input_edge(self, input: Union[Edge, Urn, str]) -> "ChartPatchBuilder":
|
|
94
50
|
"""
|
|
@@ -120,7 +76,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
120
76
|
self._add_patch(
|
|
121
77
|
ChartInfo.ASPECT_NAME,
|
|
122
78
|
"add",
|
|
123
|
-
path=
|
|
79
|
+
path=("inputEdges", input_urn),
|
|
124
80
|
value=input_urn,
|
|
125
81
|
)
|
|
126
82
|
return self
|
|
@@ -138,7 +94,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
138
94
|
self._add_patch(
|
|
139
95
|
ChartInfo.ASPECT_NAME,
|
|
140
96
|
"remove",
|
|
141
|
-
path=
|
|
97
|
+
path=("inputEdges", str(input)),
|
|
142
98
|
value={},
|
|
143
99
|
)
|
|
144
100
|
return self
|
|
@@ -159,129 +115,17 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
159
115
|
self._add_patch(
|
|
160
116
|
ChartInfo.ASPECT_NAME,
|
|
161
117
|
"add",
|
|
162
|
-
path="
|
|
118
|
+
path=("inputEdges",),
|
|
163
119
|
value=inputs,
|
|
164
120
|
)
|
|
165
121
|
return self
|
|
166
122
|
|
|
167
|
-
def add_tag(self, tag: Tag) -> "ChartPatchBuilder":
|
|
168
|
-
"""
|
|
169
|
-
Adds a tag to the ChartPatchBuilder.
|
|
170
|
-
|
|
171
|
-
Args:
|
|
172
|
-
tag: The Tag object representing the tag to be added.
|
|
173
|
-
|
|
174
|
-
Returns:
|
|
175
|
-
The ChartPatchBuilder instance.
|
|
176
|
-
"""
|
|
177
|
-
self._add_patch(
|
|
178
|
-
GlobalTags.ASPECT_NAME, "add", path=f"/tags/{tag.tag}", value=tag
|
|
179
|
-
)
|
|
180
|
-
return self
|
|
181
|
-
|
|
182
|
-
def remove_tag(self, tag: Union[str, Urn]) -> "ChartPatchBuilder":
|
|
183
|
-
"""
|
|
184
|
-
Removes a tag from the ChartPatchBuilder.
|
|
185
|
-
|
|
186
|
-
Args:
|
|
187
|
-
tag: The tag to remove, specified as a string or Urn object.
|
|
188
|
-
|
|
189
|
-
Returns:
|
|
190
|
-
The ChartPatchBuilder instance.
|
|
191
|
-
"""
|
|
192
|
-
if isinstance(tag, str) and not tag.startswith("urn:li:tag:"):
|
|
193
|
-
tag = TagUrn.create_from_id(tag)
|
|
194
|
-
self._add_patch(GlobalTags.ASPECT_NAME, "remove", path=f"/tags/{tag}", value={})
|
|
195
|
-
return self
|
|
196
|
-
|
|
197
|
-
def add_term(self, term: Term) -> "ChartPatchBuilder":
|
|
198
|
-
"""
|
|
199
|
-
Adds a glossary term to the ChartPatchBuilder.
|
|
200
|
-
|
|
201
|
-
Args:
|
|
202
|
-
term: The Term object representing the glossary term to be added.
|
|
203
|
-
|
|
204
|
-
Returns:
|
|
205
|
-
The ChartPatchBuilder instance.
|
|
206
|
-
"""
|
|
207
|
-
self._add_patch(
|
|
208
|
-
GlossaryTerms.ASPECT_NAME, "add", path=f"/terms/{term.urn}", value=term
|
|
209
|
-
)
|
|
210
|
-
return self
|
|
211
|
-
|
|
212
|
-
def remove_term(self, term: Union[str, Urn]) -> "ChartPatchBuilder":
|
|
213
|
-
"""
|
|
214
|
-
Removes a glossary term from the ChartPatchBuilder.
|
|
215
|
-
|
|
216
|
-
Args:
|
|
217
|
-
term: The term to remove, specified as a string or Urn object.
|
|
218
|
-
|
|
219
|
-
Returns:
|
|
220
|
-
The ChartPatchBuilder instance.
|
|
221
|
-
"""
|
|
222
|
-
if isinstance(term, str) and not term.startswith("urn:li:glossaryTerm:"):
|
|
223
|
-
term = "urn:li:glossaryTerm:" + term
|
|
224
|
-
self._add_patch(
|
|
225
|
-
GlossaryTerms.ASPECT_NAME, "remove", path=f"/terms/{term}", value={}
|
|
226
|
-
)
|
|
227
|
-
return self
|
|
228
|
-
|
|
229
|
-
def set_custom_properties(
|
|
230
|
-
self, custom_properties: Dict[str, str]
|
|
231
|
-
) -> "ChartPatchBuilder":
|
|
232
|
-
"""
|
|
233
|
-
Sets the custom properties for the ChartPatchBuilder.
|
|
234
|
-
|
|
235
|
-
Args:
|
|
236
|
-
custom_properties: A dictionary containing the custom properties to be set.
|
|
237
|
-
|
|
238
|
-
Returns:
|
|
239
|
-
The ChartPatchBuilder instance.
|
|
240
|
-
|
|
241
|
-
Notes:
|
|
242
|
-
This method replaces all existing custom properties with the given dictionary.
|
|
243
|
-
"""
|
|
244
|
-
self._add_patch(
|
|
245
|
-
ChartInfo.ASPECT_NAME,
|
|
246
|
-
"add",
|
|
247
|
-
path="/customProperties",
|
|
248
|
-
value=custom_properties,
|
|
249
|
-
)
|
|
250
|
-
return self
|
|
251
|
-
|
|
252
|
-
def add_custom_property(self, key: str, value: str) -> "ChartPatchBuilder":
|
|
253
|
-
"""
|
|
254
|
-
Adds a custom property to the ChartPatchBuilder.
|
|
255
|
-
|
|
256
|
-
Args:
|
|
257
|
-
key: The key of the custom property.
|
|
258
|
-
value: The value of the custom property.
|
|
259
|
-
|
|
260
|
-
Returns:
|
|
261
|
-
The ChartPatchBuilder instance.
|
|
262
|
-
"""
|
|
263
|
-
self.custom_properties_patch_helper.add_property(key, value)
|
|
264
|
-
return self
|
|
265
|
-
|
|
266
|
-
def remove_custom_property(self, key: str) -> "ChartPatchBuilder":
|
|
267
|
-
"""
|
|
268
|
-
Removes a custom property from the ChartPatchBuilder.
|
|
269
|
-
|
|
270
|
-
Args:
|
|
271
|
-
key: The key of the custom property to remove.
|
|
272
|
-
|
|
273
|
-
Returns:
|
|
274
|
-
The ChartPatchBuilder instance.
|
|
275
|
-
"""
|
|
276
|
-
self.custom_properties_patch_helper.remove_property(key)
|
|
277
|
-
return self
|
|
278
|
-
|
|
279
123
|
def set_title(self, title: str) -> "ChartPatchBuilder":
|
|
280
124
|
assert title, "ChartInfo title should not be None"
|
|
281
125
|
self._add_patch(
|
|
282
126
|
ChartInfo.ASPECT_NAME,
|
|
283
127
|
"add",
|
|
284
|
-
path="
|
|
128
|
+
path=("title",),
|
|
285
129
|
value=title,
|
|
286
130
|
)
|
|
287
131
|
|
|
@@ -292,7 +136,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
292
136
|
self._add_patch(
|
|
293
137
|
ChartInfo.ASPECT_NAME,
|
|
294
138
|
"add",
|
|
295
|
-
path="
|
|
139
|
+
path=("description",),
|
|
296
140
|
value=description,
|
|
297
141
|
)
|
|
298
142
|
|
|
@@ -303,7 +147,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
303
147
|
self._add_patch(
|
|
304
148
|
ChartInfo.ASPECT_NAME,
|
|
305
149
|
"add",
|
|
306
|
-
path="
|
|
150
|
+
path=("lastRefreshed",),
|
|
307
151
|
value=last_refreshed,
|
|
308
152
|
)
|
|
309
153
|
|
|
@@ -316,7 +160,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
316
160
|
self._add_patch(
|
|
317
161
|
ChartInfo.ASPECT_NAME,
|
|
318
162
|
"add",
|
|
319
|
-
path="
|
|
163
|
+
path=("lastModified",),
|
|
320
164
|
value=last_modified,
|
|
321
165
|
)
|
|
322
166
|
|
|
@@ -327,7 +171,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
327
171
|
self._add_patch(
|
|
328
172
|
ChartInfo.ASPECT_NAME,
|
|
329
173
|
"add",
|
|
330
|
-
path="
|
|
174
|
+
path=("externalUrl",),
|
|
331
175
|
value=external_url,
|
|
332
176
|
)
|
|
333
177
|
return self
|
|
@@ -337,7 +181,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
337
181
|
self._add_patch(
|
|
338
182
|
ChartInfo.ASPECT_NAME,
|
|
339
183
|
"add",
|
|
340
|
-
path="
|
|
184
|
+
path=("chartUrl",),
|
|
341
185
|
value=dashboard_url,
|
|
342
186
|
)
|
|
343
187
|
|
|
@@ -350,7 +194,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
350
194
|
self._add_patch(
|
|
351
195
|
ChartInfo.ASPECT_NAME,
|
|
352
196
|
"add",
|
|
353
|
-
path="
|
|
197
|
+
path=("type",),
|
|
354
198
|
value=type,
|
|
355
199
|
)
|
|
356
200
|
|
|
@@ -363,7 +207,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
363
207
|
self._add_patch(
|
|
364
208
|
ChartInfo.ASPECT_NAME,
|
|
365
209
|
"add",
|
|
366
|
-
path="
|
|
210
|
+
path=("access",),
|
|
367
211
|
value=access,
|
|
368
212
|
)
|
|
369
213
|
|
|
@@ -375,7 +219,7 @@ class ChartPatchBuilder(MetadataPatchProposal):
|
|
|
375
219
|
self._add_patch(
|
|
376
220
|
aspect_name=ChartInfo.ASPECT_NAME,
|
|
377
221
|
op="add",
|
|
378
|
-
path=
|
|
222
|
+
path=("inputs", urn),
|
|
379
223
|
value=urn,
|
|
380
224
|
)
|
|
381
225
|
|
datahub/specific/dashboard.py
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import List, Optional, Tuple, Union
|
|
2
2
|
|
|
3
|
-
from datahub.emitter.mcp_patch_builder import MetadataPatchProposal
|
|
3
|
+
from datahub.emitter.mcp_patch_builder import MetadataPatchProposal, PatchPath
|
|
4
4
|
from datahub.metadata.schema_classes import (
|
|
5
5
|
AccessLevelClass,
|
|
6
6
|
ChangeAuditStampsClass,
|
|
7
7
|
DashboardInfoClass as DashboardInfo,
|
|
8
8
|
EdgeClass as Edge,
|
|
9
|
-
GlobalTagsClass as GlobalTags,
|
|
10
|
-
GlossaryTermAssociationClass as Term,
|
|
11
|
-
GlossaryTermsClass as GlossaryTerms,
|
|
12
9
|
KafkaAuditHeaderClass,
|
|
13
|
-
OwnerClass as Owner,
|
|
14
|
-
OwnershipTypeClass,
|
|
15
10
|
SystemMetadataClass,
|
|
16
|
-
TagAssociationClass as Tag,
|
|
17
11
|
)
|
|
18
|
-
from datahub.specific.custom_properties import
|
|
19
|
-
from datahub.specific.ownership import
|
|
20
|
-
from datahub.
|
|
12
|
+
from datahub.specific.aspect_helpers.custom_properties import HasCustomPropertiesPatch
|
|
13
|
+
from datahub.specific.aspect_helpers.ownership import HasOwnershipPatch
|
|
14
|
+
from datahub.specific.aspect_helpers.tags import HasTagsPatch
|
|
15
|
+
from datahub.specific.aspect_helpers.terms import HasTermsPatch
|
|
21
16
|
from datahub.utilities.urns.urn import Urn
|
|
22
17
|
|
|
23
18
|
|
|
24
|
-
class DashboardPatchBuilder(
|
|
19
|
+
class DashboardPatchBuilder(
|
|
20
|
+
HasOwnershipPatch,
|
|
21
|
+
HasCustomPropertiesPatch,
|
|
22
|
+
HasTagsPatch,
|
|
23
|
+
HasTermsPatch,
|
|
24
|
+
MetadataPatchProposal,
|
|
25
|
+
):
|
|
25
26
|
def __init__(
|
|
26
27
|
self,
|
|
27
28
|
urn: str,
|
|
@@ -39,55 +40,10 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
39
40
|
super().__init__(
|
|
40
41
|
urn, system_metadata=system_metadata, audit_header=audit_header
|
|
41
42
|
)
|
|
42
|
-
self.custom_properties_patch_helper = CustomPropertiesPatchHelper(
|
|
43
|
-
self, DashboardInfo.ASPECT_NAME
|
|
44
|
-
)
|
|
45
|
-
self.ownership_patch_helper = OwnershipPatchHelper(self)
|
|
46
|
-
|
|
47
|
-
def add_owner(self, owner: Owner) -> "DashboardPatchBuilder":
|
|
48
|
-
"""
|
|
49
|
-
Adds an owner to the DashboardPatchBuilder.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
owner: The Owner object to add.
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
The DashboardPatchBuilder instance.
|
|
56
|
-
"""
|
|
57
|
-
self.ownership_patch_helper.add_owner(owner)
|
|
58
|
-
return self
|
|
59
|
-
|
|
60
|
-
def remove_owner(
|
|
61
|
-
self, owner: str, owner_type: Optional[OwnershipTypeClass] = None
|
|
62
|
-
) -> "DashboardPatchBuilder":
|
|
63
|
-
"""
|
|
64
|
-
Removes an owner from the DashboardPatchBuilder.
|
|
65
|
-
|
|
66
|
-
Args:
|
|
67
|
-
owner: The owner to remove.
|
|
68
|
-
owner_type: The ownership type of the owner (optional).
|
|
69
|
-
|
|
70
|
-
Returns:
|
|
71
|
-
The DashboardPatchBuilder instance.
|
|
72
|
-
|
|
73
|
-
Notes:
|
|
74
|
-
`owner_type` is optional.
|
|
75
|
-
"""
|
|
76
|
-
self.ownership_patch_helper.remove_owner(owner, owner_type)
|
|
77
|
-
return self
|
|
78
|
-
|
|
79
|
-
def set_owners(self, owners: List[Owner]) -> "DashboardPatchBuilder":
|
|
80
|
-
"""
|
|
81
|
-
Sets the owners of the DashboardPatchBuilder.
|
|
82
43
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Returns:
|
|
87
|
-
The DashboardPatchBuilder instance.
|
|
88
|
-
"""
|
|
89
|
-
self.ownership_patch_helper.set_owners(owners)
|
|
90
|
-
return self
|
|
44
|
+
@classmethod
|
|
45
|
+
def _custom_properties_location(cls) -> Tuple[str, PatchPath]:
|
|
46
|
+
return DashboardInfo.ASPECT_NAME, ("customProperties",)
|
|
91
47
|
|
|
92
48
|
def add_dataset_edge(
|
|
93
49
|
self, dataset: Union[Edge, Urn, str]
|
|
@@ -126,7 +82,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
126
82
|
self._add_patch(
|
|
127
83
|
DashboardInfo.ASPECT_NAME,
|
|
128
84
|
"add",
|
|
129
|
-
path=
|
|
85
|
+
path=("datasetEdges", dataset_urn),
|
|
130
86
|
value=dataset_edge,
|
|
131
87
|
)
|
|
132
88
|
return self
|
|
@@ -144,7 +100,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
144
100
|
self._add_patch(
|
|
145
101
|
DashboardInfo.ASPECT_NAME,
|
|
146
102
|
"remove",
|
|
147
|
-
path=
|
|
103
|
+
path=("datasetEdges", dataset),
|
|
148
104
|
value={},
|
|
149
105
|
)
|
|
150
106
|
return self
|
|
@@ -169,7 +125,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
169
125
|
self._add_patch(
|
|
170
126
|
DashboardInfo.ASPECT_NAME,
|
|
171
127
|
"add",
|
|
172
|
-
path="
|
|
128
|
+
path=("datasetEdges",),
|
|
173
129
|
value=datasets,
|
|
174
130
|
)
|
|
175
131
|
return self
|
|
@@ -209,7 +165,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
209
165
|
self._add_patch(
|
|
210
166
|
DashboardInfo.ASPECT_NAME,
|
|
211
167
|
"add",
|
|
212
|
-
path=
|
|
168
|
+
path=("chartEdges", chart_urn),
|
|
213
169
|
value=chart_edge,
|
|
214
170
|
)
|
|
215
171
|
return self
|
|
@@ -227,7 +183,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
227
183
|
self._add_patch(
|
|
228
184
|
DashboardInfo.ASPECT_NAME,
|
|
229
185
|
"remove",
|
|
230
|
-
path=
|
|
186
|
+
path=("chartEdges", chart),
|
|
231
187
|
value={},
|
|
232
188
|
)
|
|
233
189
|
return self
|
|
@@ -252,129 +208,17 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
252
208
|
self._add_patch(
|
|
253
209
|
DashboardInfo.ASPECT_NAME,
|
|
254
210
|
"add",
|
|
255
|
-
path="
|
|
211
|
+
path=("chartEdges",),
|
|
256
212
|
value=charts,
|
|
257
213
|
)
|
|
258
214
|
return self
|
|
259
215
|
|
|
260
|
-
def add_tag(self, tag: Tag) -> "DashboardPatchBuilder":
|
|
261
|
-
"""
|
|
262
|
-
Adds a tag to the DashboardPatchBuilder.
|
|
263
|
-
|
|
264
|
-
Args:
|
|
265
|
-
tag: The Tag object representing the tag to be added.
|
|
266
|
-
|
|
267
|
-
Returns:
|
|
268
|
-
The DashboardPatchBuilder instance.
|
|
269
|
-
"""
|
|
270
|
-
self._add_patch(
|
|
271
|
-
GlobalTags.ASPECT_NAME, "add", path=f"/tags/{tag.tag}", value=tag
|
|
272
|
-
)
|
|
273
|
-
return self
|
|
274
|
-
|
|
275
|
-
def remove_tag(self, tag: Union[str, Urn]) -> "DashboardPatchBuilder":
|
|
276
|
-
"""
|
|
277
|
-
Removes a tag from the DashboardPatchBuilder.
|
|
278
|
-
|
|
279
|
-
Args:
|
|
280
|
-
tag: The tag to remove, specified as a string or Urn object.
|
|
281
|
-
|
|
282
|
-
Returns:
|
|
283
|
-
The DashboardPatchBuilder instance.
|
|
284
|
-
"""
|
|
285
|
-
if isinstance(tag, str) and not tag.startswith("urn:li:tag:"):
|
|
286
|
-
tag = TagUrn.create_from_id(tag)
|
|
287
|
-
self._add_patch(GlobalTags.ASPECT_NAME, "remove", path=f"/tags/{tag}", value={})
|
|
288
|
-
return self
|
|
289
|
-
|
|
290
|
-
def add_term(self, term: Term) -> "DashboardPatchBuilder":
|
|
291
|
-
"""
|
|
292
|
-
Adds a glossary term to the DashboardPatchBuilder.
|
|
293
|
-
|
|
294
|
-
Args:
|
|
295
|
-
term: The Term object representing the glossary term to be added.
|
|
296
|
-
|
|
297
|
-
Returns:
|
|
298
|
-
The DashboardPatchBuilder instance.
|
|
299
|
-
"""
|
|
300
|
-
self._add_patch(
|
|
301
|
-
GlossaryTerms.ASPECT_NAME, "add", path=f"/terms/{term.urn}", value=term
|
|
302
|
-
)
|
|
303
|
-
return self
|
|
304
|
-
|
|
305
|
-
def remove_term(self, term: Union[str, Urn]) -> "DashboardPatchBuilder":
|
|
306
|
-
"""
|
|
307
|
-
Removes a glossary term from the DashboardPatchBuilder.
|
|
308
|
-
|
|
309
|
-
Args:
|
|
310
|
-
term: The term to remove, specified as a string or Urn object.
|
|
311
|
-
|
|
312
|
-
Returns:
|
|
313
|
-
The DashboardPatchBuilder instance.
|
|
314
|
-
"""
|
|
315
|
-
if isinstance(term, str) and not term.startswith("urn:li:glossaryTerm:"):
|
|
316
|
-
term = "urn:li:glossaryTerm:" + term
|
|
317
|
-
self._add_patch(
|
|
318
|
-
GlossaryTerms.ASPECT_NAME, "remove", path=f"/terms/{term}", value={}
|
|
319
|
-
)
|
|
320
|
-
return self
|
|
321
|
-
|
|
322
|
-
def set_custom_properties(
|
|
323
|
-
self, custom_properties: Dict[str, str]
|
|
324
|
-
) -> "DashboardPatchBuilder":
|
|
325
|
-
"""
|
|
326
|
-
Sets the custom properties for the DashboardPatchBuilder.
|
|
327
|
-
|
|
328
|
-
Args:
|
|
329
|
-
custom_properties: A dictionary containing the custom properties to be set.
|
|
330
|
-
|
|
331
|
-
Returns:
|
|
332
|
-
The DashboardPatchBuilder instance.
|
|
333
|
-
|
|
334
|
-
Notes:
|
|
335
|
-
This method replaces all existing custom properties with the given dictionary.
|
|
336
|
-
"""
|
|
337
|
-
self._add_patch(
|
|
338
|
-
DashboardInfo.ASPECT_NAME,
|
|
339
|
-
"add",
|
|
340
|
-
path="/customProperties",
|
|
341
|
-
value=custom_properties,
|
|
342
|
-
)
|
|
343
|
-
return self
|
|
344
|
-
|
|
345
|
-
def add_custom_property(self, key: str, value: str) -> "DashboardPatchBuilder":
|
|
346
|
-
"""
|
|
347
|
-
Adds a custom property to the DashboardPatchBuilder.
|
|
348
|
-
|
|
349
|
-
Args:
|
|
350
|
-
key: The key of the custom property.
|
|
351
|
-
value: The value of the custom property.
|
|
352
|
-
|
|
353
|
-
Returns:
|
|
354
|
-
The DashboardPatchBuilder instance.
|
|
355
|
-
"""
|
|
356
|
-
self.custom_properties_patch_helper.add_property(key, value)
|
|
357
|
-
return self
|
|
358
|
-
|
|
359
|
-
def remove_custom_property(self, key: str) -> "DashboardPatchBuilder":
|
|
360
|
-
"""
|
|
361
|
-
Removes a custom property from the DashboardPatchBuilder.
|
|
362
|
-
|
|
363
|
-
Args:
|
|
364
|
-
key: The key of the custom property to remove.
|
|
365
|
-
|
|
366
|
-
Returns:
|
|
367
|
-
The DashboardPatchBuilder instance.
|
|
368
|
-
"""
|
|
369
|
-
self.custom_properties_patch_helper.remove_property(key)
|
|
370
|
-
return self
|
|
371
|
-
|
|
372
216
|
def set_title(self, title: str) -> "DashboardPatchBuilder":
|
|
373
217
|
assert title, "DashboardInfo title should not be None"
|
|
374
218
|
self._add_patch(
|
|
375
219
|
DashboardInfo.ASPECT_NAME,
|
|
376
220
|
"add",
|
|
377
|
-
path="
|
|
221
|
+
path=("title",),
|
|
378
222
|
value=title,
|
|
379
223
|
)
|
|
380
224
|
|
|
@@ -385,27 +229,18 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
385
229
|
self._add_patch(
|
|
386
230
|
DashboardInfo.ASPECT_NAME,
|
|
387
231
|
"add",
|
|
388
|
-
path="
|
|
232
|
+
path=("description",),
|
|
389
233
|
value=description,
|
|
390
234
|
)
|
|
391
235
|
|
|
392
236
|
return self
|
|
393
237
|
|
|
394
|
-
def add_custom_properties(
|
|
395
|
-
self, custom_properties: Optional[Dict[str, str]] = None
|
|
396
|
-
) -> "DashboardPatchBuilder":
|
|
397
|
-
if custom_properties:
|
|
398
|
-
for key, value in custom_properties.items():
|
|
399
|
-
self.custom_properties_patch_helper.add_property(key, value)
|
|
400
|
-
|
|
401
|
-
return self
|
|
402
|
-
|
|
403
238
|
def set_external_url(self, external_url: Optional[str]) -> "DashboardPatchBuilder":
|
|
404
239
|
if external_url:
|
|
405
240
|
self._add_patch(
|
|
406
241
|
DashboardInfo.ASPECT_NAME,
|
|
407
242
|
"add",
|
|
408
|
-
path="
|
|
243
|
+
path=("externalUrl",),
|
|
409
244
|
value=external_url,
|
|
410
245
|
)
|
|
411
246
|
return self
|
|
@@ -416,7 +251,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
416
251
|
self._add_patch(
|
|
417
252
|
aspect_name=DashboardInfo.ASPECT_NAME,
|
|
418
253
|
op="add",
|
|
419
|
-
path=
|
|
254
|
+
path=("charts", urn),
|
|
420
255
|
value=urn,
|
|
421
256
|
)
|
|
422
257
|
|
|
@@ -430,7 +265,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
430
265
|
self._add_patch(
|
|
431
266
|
aspect_name=DashboardInfo.ASPECT_NAME,
|
|
432
267
|
op="add",
|
|
433
|
-
path=
|
|
268
|
+
path=("datasets", urn),
|
|
434
269
|
value=urn,
|
|
435
270
|
)
|
|
436
271
|
|
|
@@ -443,7 +278,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
443
278
|
self._add_patch(
|
|
444
279
|
DashboardInfo.ASPECT_NAME,
|
|
445
280
|
"add",
|
|
446
|
-
path="
|
|
281
|
+
path=("dashboardUrl",),
|
|
447
282
|
value=dashboard_url,
|
|
448
283
|
)
|
|
449
284
|
|
|
@@ -456,7 +291,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
456
291
|
self._add_patch(
|
|
457
292
|
DashboardInfo.ASPECT_NAME,
|
|
458
293
|
"add",
|
|
459
|
-
path="
|
|
294
|
+
path=("access",),
|
|
460
295
|
value=access,
|
|
461
296
|
)
|
|
462
297
|
|
|
@@ -469,7 +304,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
469
304
|
self._add_patch(
|
|
470
305
|
DashboardInfo.ASPECT_NAME,
|
|
471
306
|
"add",
|
|
472
|
-
path="
|
|
307
|
+
path=("lastRefreshed",),
|
|
473
308
|
value=last_refreshed,
|
|
474
309
|
)
|
|
475
310
|
|
|
@@ -482,7 +317,7 @@ class DashboardPatchBuilder(MetadataPatchProposal):
|
|
|
482
317
|
self._add_patch(
|
|
483
318
|
DashboardInfo.ASPECT_NAME,
|
|
484
319
|
"add",
|
|
485
|
-
path="
|
|
320
|
+
path=("lastModified",),
|
|
486
321
|
value=last_modified,
|
|
487
322
|
)
|
|
488
323
|
|