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/dataset.py
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Generic, List, Optional, Tuple, TypeVar, 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.com.linkedin.pegasus2avro.common import TimeStamp
|
|
5
5
|
from datahub.metadata.schema_classes import (
|
|
6
6
|
DatasetPropertiesClass as DatasetProperties,
|
|
7
7
|
EditableDatasetPropertiesClass as EditableDatasetProperties,
|
|
8
8
|
EditableSchemaMetadataClass as EditableSchemaMetadata,
|
|
9
9
|
FineGrainedLineageClass as FineGrainedLineage,
|
|
10
|
-
GlobalTagsClass as GlobalTags,
|
|
11
10
|
GlossaryTermAssociationClass as Term,
|
|
12
|
-
GlossaryTermsClass as GlossaryTerms,
|
|
13
11
|
KafkaAuditHeaderClass,
|
|
14
|
-
OwnerClass as Owner,
|
|
15
|
-
OwnershipTypeClass,
|
|
16
12
|
SchemaMetadataClass,
|
|
17
13
|
SystemMetadataClass,
|
|
18
14
|
TagAssociationClass as Tag,
|
|
19
15
|
UpstreamClass as Upstream,
|
|
20
16
|
UpstreamLineageClass as UpstreamLineage,
|
|
21
17
|
)
|
|
22
|
-
from datahub.specific.custom_properties import
|
|
23
|
-
from datahub.specific.ownership import
|
|
24
|
-
from datahub.specific.structured_properties import
|
|
18
|
+
from datahub.specific.aspect_helpers.custom_properties import HasCustomPropertiesPatch
|
|
19
|
+
from datahub.specific.aspect_helpers.ownership import HasOwnershipPatch
|
|
20
|
+
from datahub.specific.aspect_helpers.structured_properties import (
|
|
21
|
+
HasStructuredPropertiesPatch,
|
|
22
|
+
)
|
|
23
|
+
from datahub.specific.aspect_helpers.tags import HasTagsPatch
|
|
24
|
+
from datahub.specific.aspect_helpers.terms import HasTermsPatch
|
|
25
25
|
from datahub.utilities.urns.tag_urn import TagUrn
|
|
26
26
|
from datahub.utilities.urns.urn import Urn
|
|
27
27
|
|
|
@@ -48,7 +48,7 @@ class FieldPatchHelper(Generic[_Parent]):
|
|
|
48
48
|
self._parent._add_patch(
|
|
49
49
|
self.aspect_name,
|
|
50
50
|
"add",
|
|
51
|
-
path=
|
|
51
|
+
path=(self.aspect_field, self.field_path, "globalTags", "tags", tag.tag),
|
|
52
52
|
value=tag,
|
|
53
53
|
)
|
|
54
54
|
return self
|
|
@@ -59,7 +59,7 @@ class FieldPatchHelper(Generic[_Parent]):
|
|
|
59
59
|
self._parent._add_patch(
|
|
60
60
|
self.aspect_name,
|
|
61
61
|
"remove",
|
|
62
|
-
path=
|
|
62
|
+
path=(self.aspect_field, self.field_path, "globalTags", "tags", tag),
|
|
63
63
|
value={},
|
|
64
64
|
)
|
|
65
65
|
return self
|
|
@@ -68,7 +68,13 @@ class FieldPatchHelper(Generic[_Parent]):
|
|
|
68
68
|
self._parent._add_patch(
|
|
69
69
|
self.aspect_name,
|
|
70
70
|
"add",
|
|
71
|
-
path=
|
|
71
|
+
path=(
|
|
72
|
+
self.aspect_field,
|
|
73
|
+
self.field_path,
|
|
74
|
+
"glossaryTerms",
|
|
75
|
+
"terms",
|
|
76
|
+
term.urn,
|
|
77
|
+
),
|
|
72
78
|
value=term,
|
|
73
79
|
)
|
|
74
80
|
return self
|
|
@@ -79,7 +85,7 @@ class FieldPatchHelper(Generic[_Parent]):
|
|
|
79
85
|
self._parent._add_patch(
|
|
80
86
|
self.aspect_name,
|
|
81
87
|
"remove",
|
|
82
|
-
path=
|
|
88
|
+
path=(self.aspect_field, self.field_path, "glossaryTerms", "terms", term),
|
|
83
89
|
value={},
|
|
84
90
|
)
|
|
85
91
|
return self
|
|
@@ -88,7 +94,14 @@ class FieldPatchHelper(Generic[_Parent]):
|
|
|
88
94
|
return self._parent
|
|
89
95
|
|
|
90
96
|
|
|
91
|
-
class DatasetPatchBuilder(
|
|
97
|
+
class DatasetPatchBuilder(
|
|
98
|
+
HasOwnershipPatch,
|
|
99
|
+
HasCustomPropertiesPatch,
|
|
100
|
+
HasStructuredPropertiesPatch,
|
|
101
|
+
HasTagsPatch,
|
|
102
|
+
HasTermsPatch,
|
|
103
|
+
MetadataPatchProposal,
|
|
104
|
+
):
|
|
92
105
|
def __init__(
|
|
93
106
|
self,
|
|
94
107
|
urn: str,
|
|
@@ -98,34 +111,16 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
98
111
|
super().__init__(
|
|
99
112
|
urn, system_metadata=system_metadata, audit_header=audit_header
|
|
100
113
|
)
|
|
101
|
-
self.custom_properties_patch_helper = CustomPropertiesPatchHelper(
|
|
102
|
-
self, DatasetProperties.ASPECT_NAME
|
|
103
|
-
)
|
|
104
|
-
self.ownership_patch_helper = OwnershipPatchHelper(self)
|
|
105
|
-
self.structured_properties_patch_helper = StructuredPropertiesPatchHelper(self)
|
|
106
|
-
|
|
107
|
-
def add_owner(self, owner: Owner) -> "DatasetPatchBuilder":
|
|
108
|
-
self.ownership_patch_helper.add_owner(owner)
|
|
109
|
-
return self
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"""
|
|
115
|
-
param: owner_type is optional
|
|
116
|
-
"""
|
|
117
|
-
self.ownership_patch_helper.remove_owner(owner, owner_type)
|
|
118
|
-
return self
|
|
119
|
-
|
|
120
|
-
def set_owners(self, owners: List[Owner]) -> "DatasetPatchBuilder":
|
|
121
|
-
self.ownership_patch_helper.set_owners(owners)
|
|
122
|
-
return self
|
|
115
|
+
@classmethod
|
|
116
|
+
def _custom_properties_location(cls) -> Tuple[str, PatchPath]:
|
|
117
|
+
return DatasetProperties.ASPECT_NAME, ("customProperties",)
|
|
123
118
|
|
|
124
119
|
def add_upstream_lineage(self, upstream: Upstream) -> "DatasetPatchBuilder":
|
|
125
120
|
self._add_patch(
|
|
126
121
|
UpstreamLineage.ASPECT_NAME,
|
|
127
122
|
"add",
|
|
128
|
-
path=
|
|
123
|
+
path=("upstreams", upstream.dataset),
|
|
129
124
|
value=upstream,
|
|
130
125
|
)
|
|
131
126
|
return self
|
|
@@ -136,14 +131,14 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
136
131
|
self._add_patch(
|
|
137
132
|
UpstreamLineage.ASPECT_NAME,
|
|
138
133
|
"remove",
|
|
139
|
-
path=
|
|
134
|
+
path=("upstreams", dataset),
|
|
140
135
|
value={},
|
|
141
136
|
)
|
|
142
137
|
return self
|
|
143
138
|
|
|
144
139
|
def set_upstream_lineages(self, upstreams: List[Upstream]) -> "DatasetPatchBuilder":
|
|
145
140
|
self._add_patch(
|
|
146
|
-
UpstreamLineage.ASPECT_NAME, "add", path="
|
|
141
|
+
UpstreamLineage.ASPECT_NAME, "add", path=("upstreams",), value=upstreams
|
|
147
142
|
)
|
|
148
143
|
return self
|
|
149
144
|
|
|
@@ -159,7 +154,7 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
159
154
|
self._add_patch(
|
|
160
155
|
UpstreamLineage.ASPECT_NAME,
|
|
161
156
|
"add",
|
|
162
|
-
path=
|
|
157
|
+
path=self._build_fine_grained_path(
|
|
163
158
|
transform_op, downstream_urn, query_id, upstream_urn
|
|
164
159
|
),
|
|
165
160
|
value={"confidenceScore": fine_grained_lineage.confidenceScore},
|
|
@@ -179,12 +174,15 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
179
174
|
return transform_op, downstream_urn, query_id
|
|
180
175
|
|
|
181
176
|
@classmethod
|
|
182
|
-
def
|
|
177
|
+
def _build_fine_grained_path(
|
|
183
178
|
cls, transform_op: str, downstream_urn: str, query_id: str, upstream_urn: str
|
|
184
|
-
) ->
|
|
179
|
+
) -> PatchPath:
|
|
185
180
|
return (
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
"fineGrainedLineages",
|
|
182
|
+
transform_op,
|
|
183
|
+
downstream_urn,
|
|
184
|
+
query_id,
|
|
185
|
+
upstream_urn,
|
|
188
186
|
)
|
|
189
187
|
|
|
190
188
|
def remove_fine_grained_upstream_lineage(
|
|
@@ -199,7 +197,7 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
199
197
|
self._add_patch(
|
|
200
198
|
UpstreamLineage.ASPECT_NAME,
|
|
201
199
|
"remove",
|
|
202
|
-
path=
|
|
200
|
+
path=self._build_fine_grained_path(
|
|
203
201
|
transform_op, downstream_urn, query_id, upstream_urn
|
|
204
202
|
),
|
|
205
203
|
value={},
|
|
@@ -212,37 +210,11 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
212
210
|
self._add_patch(
|
|
213
211
|
UpstreamLineage.ASPECT_NAME,
|
|
214
212
|
"add",
|
|
215
|
-
path="
|
|
213
|
+
path=("fineGrainedLineages",),
|
|
216
214
|
value=fine_grained_lineages,
|
|
217
215
|
)
|
|
218
216
|
return self
|
|
219
217
|
|
|
220
|
-
def add_tag(self, tag: Tag) -> "DatasetPatchBuilder":
|
|
221
|
-
self._add_patch(
|
|
222
|
-
GlobalTags.ASPECT_NAME, "add", path=f"/tags/{tag.tag}", value=tag
|
|
223
|
-
)
|
|
224
|
-
return self
|
|
225
|
-
|
|
226
|
-
def remove_tag(self, tag: Union[str, Urn]) -> "DatasetPatchBuilder":
|
|
227
|
-
if isinstance(tag, str) and not tag.startswith("urn:li:tag:"):
|
|
228
|
-
tag = TagUrn.create_from_id(tag)
|
|
229
|
-
self._add_patch(GlobalTags.ASPECT_NAME, "remove", path=f"/tags/{tag}", value={})
|
|
230
|
-
return self
|
|
231
|
-
|
|
232
|
-
def add_term(self, term: Term) -> "DatasetPatchBuilder":
|
|
233
|
-
self._add_patch(
|
|
234
|
-
GlossaryTerms.ASPECT_NAME, "add", path=f"/terms/{term.urn}", value=term
|
|
235
|
-
)
|
|
236
|
-
return self
|
|
237
|
-
|
|
238
|
-
def remove_term(self, term: Union[str, Urn]) -> "DatasetPatchBuilder":
|
|
239
|
-
if isinstance(term, str) and not term.startswith("urn:li:glossaryTerm:"):
|
|
240
|
-
term = "urn:li:glossaryTerm:" + term
|
|
241
|
-
self._add_patch(
|
|
242
|
-
GlossaryTerms.ASPECT_NAME, "remove", path=f"/terms/{term}", value={}
|
|
243
|
-
)
|
|
244
|
-
return self
|
|
245
|
-
|
|
246
218
|
def for_field(
|
|
247
219
|
self, field_path: str, editable: bool = True
|
|
248
220
|
) -> FieldPatchHelper["DatasetPatchBuilder"]:
|
|
@@ -269,38 +241,11 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
269
241
|
else EditableDatasetProperties.ASPECT_NAME
|
|
270
242
|
),
|
|
271
243
|
"add",
|
|
272
|
-
path="
|
|
244
|
+
path=("description",),
|
|
273
245
|
value=description,
|
|
274
246
|
)
|
|
275
247
|
return self
|
|
276
248
|
|
|
277
|
-
def set_custom_properties(
|
|
278
|
-
self, custom_properties: Dict[str, str]
|
|
279
|
-
) -> "DatasetPatchBuilder":
|
|
280
|
-
self._add_patch(
|
|
281
|
-
DatasetProperties.ASPECT_NAME,
|
|
282
|
-
"add",
|
|
283
|
-
path="/customProperties",
|
|
284
|
-
value=custom_properties,
|
|
285
|
-
)
|
|
286
|
-
return self
|
|
287
|
-
|
|
288
|
-
def add_custom_property(self, key: str, value: str) -> "DatasetPatchBuilder":
|
|
289
|
-
self.custom_properties_patch_helper.add_property(key, value)
|
|
290
|
-
return self
|
|
291
|
-
|
|
292
|
-
def add_custom_properties(
|
|
293
|
-
self, custom_properties: Optional[Dict[str, str]] = None
|
|
294
|
-
) -> "DatasetPatchBuilder":
|
|
295
|
-
if custom_properties is not None:
|
|
296
|
-
for key, value in custom_properties.items():
|
|
297
|
-
self.custom_properties_patch_helper.add_property(key, value)
|
|
298
|
-
return self
|
|
299
|
-
|
|
300
|
-
def remove_custom_property(self, key: str) -> "DatasetPatchBuilder":
|
|
301
|
-
self.custom_properties_patch_helper.remove_property(key)
|
|
302
|
-
return self
|
|
303
|
-
|
|
304
249
|
def set_display_name(
|
|
305
250
|
self, display_name: Optional[str] = None
|
|
306
251
|
) -> "DatasetPatchBuilder":
|
|
@@ -308,7 +253,7 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
308
253
|
self._add_patch(
|
|
309
254
|
DatasetProperties.ASPECT_NAME,
|
|
310
255
|
"add",
|
|
311
|
-
path="
|
|
256
|
+
path=("name",),
|
|
312
257
|
value=display_name,
|
|
313
258
|
)
|
|
314
259
|
return self
|
|
@@ -320,7 +265,7 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
320
265
|
self._add_patch(
|
|
321
266
|
DatasetProperties.ASPECT_NAME,
|
|
322
267
|
"add",
|
|
323
|
-
path="
|
|
268
|
+
path=("qualifiedName",),
|
|
324
269
|
value=qualified_name,
|
|
325
270
|
)
|
|
326
271
|
return self
|
|
@@ -332,7 +277,7 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
332
277
|
self._add_patch(
|
|
333
278
|
DatasetProperties.ASPECT_NAME,
|
|
334
279
|
"add",
|
|
335
|
-
path="
|
|
280
|
+
path=("created",),
|
|
336
281
|
value=timestamp,
|
|
337
282
|
)
|
|
338
283
|
return self
|
|
@@ -344,37 +289,7 @@ class DatasetPatchBuilder(MetadataPatchProposal):
|
|
|
344
289
|
self._add_patch(
|
|
345
290
|
DatasetProperties.ASPECT_NAME,
|
|
346
291
|
"add",
|
|
347
|
-
path="
|
|
292
|
+
path=("lastModified",),
|
|
348
293
|
value=timestamp,
|
|
349
294
|
)
|
|
350
295
|
return self
|
|
351
|
-
|
|
352
|
-
def set_structured_property(
|
|
353
|
-
self, property_name: str, value: Union[str, float, List[Union[str, float]]]
|
|
354
|
-
) -> "DatasetPatchBuilder":
|
|
355
|
-
"""
|
|
356
|
-
This is a helper method to set a structured property.
|
|
357
|
-
@param property_name: the name of the property (either bare or urn form)
|
|
358
|
-
@param value: the value of the property (for multi-valued properties, this can be a list)
|
|
359
|
-
"""
|
|
360
|
-
self.structured_properties_patch_helper.set_property(property_name, value)
|
|
361
|
-
return self
|
|
362
|
-
|
|
363
|
-
def add_structured_property(
|
|
364
|
-
self, property_name: str, value: Union[str, float]
|
|
365
|
-
) -> "DatasetPatchBuilder":
|
|
366
|
-
"""
|
|
367
|
-
This is a helper method to add a structured property.
|
|
368
|
-
@param property_name: the name of the property (either bare or urn form)
|
|
369
|
-
@param value: the value of the property (for multi-valued properties, this value will be appended to the list)
|
|
370
|
-
"""
|
|
371
|
-
self.structured_properties_patch_helper.add_property(property_name, value)
|
|
372
|
-
return self
|
|
373
|
-
|
|
374
|
-
def remove_structured_property(self, property_name: str) -> "DatasetPatchBuilder":
|
|
375
|
-
"""
|
|
376
|
-
This is a helper method to remove a structured property.
|
|
377
|
-
@param property_name: the name of the property (either bare or urn form)
|
|
378
|
-
"""
|
|
379
|
-
self.structured_properties_patch_helper.remove_property(property_name)
|
|
380
|
-
return self
|
datahub/specific/form.py
CHANGED
|
@@ -5,15 +5,13 @@ from datahub.metadata.schema_classes import (
|
|
|
5
5
|
FormInfoClass as FormInfo,
|
|
6
6
|
FormPromptClass,
|
|
7
7
|
KafkaAuditHeaderClass,
|
|
8
|
-
OwnerClass as Owner,
|
|
9
|
-
OwnershipTypeClass,
|
|
10
8
|
SystemMetadataClass,
|
|
11
9
|
)
|
|
12
|
-
from datahub.specific.ownership import
|
|
10
|
+
from datahub.specific.aspect_helpers.ownership import HasOwnershipPatch
|
|
13
11
|
from datahub.utilities.urns.urn import Urn
|
|
14
12
|
|
|
15
13
|
|
|
16
|
-
class FormPatchBuilder(MetadataPatchProposal):
|
|
14
|
+
class FormPatchBuilder(HasOwnershipPatch, MetadataPatchProposal):
|
|
17
15
|
def __init__(
|
|
18
16
|
self,
|
|
19
17
|
urn: str,
|
|
@@ -23,31 +21,13 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
23
21
|
super().__init__(
|
|
24
22
|
urn, system_metadata=system_metadata, audit_header=audit_header
|
|
25
23
|
)
|
|
26
|
-
self.ownership_patch_helper = OwnershipPatchHelper(self)
|
|
27
|
-
|
|
28
|
-
def add_owner(self, owner: Owner) -> "FormPatchBuilder":
|
|
29
|
-
self.ownership_patch_helper.add_owner(owner)
|
|
30
|
-
return self
|
|
31
|
-
|
|
32
|
-
def remove_owner(
|
|
33
|
-
self, owner: str, owner_type: Optional[OwnershipTypeClass] = None
|
|
34
|
-
) -> "FormPatchBuilder":
|
|
35
|
-
"""
|
|
36
|
-
param: owner_type is optional
|
|
37
|
-
"""
|
|
38
|
-
self.ownership_patch_helper.remove_owner(owner, owner_type)
|
|
39
|
-
return self
|
|
40
|
-
|
|
41
|
-
def set_owners(self, owners: List[Owner]) -> "FormPatchBuilder":
|
|
42
|
-
self.ownership_patch_helper.set_owners(owners)
|
|
43
|
-
return self
|
|
44
24
|
|
|
45
25
|
def set_name(self, name: Optional[str] = None) -> "FormPatchBuilder":
|
|
46
26
|
if name is not None:
|
|
47
27
|
self._add_patch(
|
|
48
28
|
FormInfo.ASPECT_NAME,
|
|
49
29
|
"add",
|
|
50
|
-
path="
|
|
30
|
+
path=("name",),
|
|
51
31
|
value=name,
|
|
52
32
|
)
|
|
53
33
|
return self
|
|
@@ -57,7 +37,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
57
37
|
self._add_patch(
|
|
58
38
|
FormInfo.ASPECT_NAME,
|
|
59
39
|
"add",
|
|
60
|
-
path="
|
|
40
|
+
path=("description",),
|
|
61
41
|
value=description,
|
|
62
42
|
)
|
|
63
43
|
return self
|
|
@@ -67,7 +47,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
67
47
|
self._add_patch(
|
|
68
48
|
FormInfo.ASPECT_NAME,
|
|
69
49
|
"add",
|
|
70
|
-
path="
|
|
50
|
+
path=("type",),
|
|
71
51
|
value=type,
|
|
72
52
|
)
|
|
73
53
|
return self
|
|
@@ -76,7 +56,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
76
56
|
self._add_patch(
|
|
77
57
|
FormInfo.ASPECT_NAME,
|
|
78
58
|
"add",
|
|
79
|
-
path=
|
|
59
|
+
path=("prompts", prompt.id),
|
|
80
60
|
value=prompt,
|
|
81
61
|
)
|
|
82
62
|
return self
|
|
@@ -90,7 +70,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
90
70
|
self._add_patch(
|
|
91
71
|
FormInfo.ASPECT_NAME,
|
|
92
72
|
"remove",
|
|
93
|
-
path=
|
|
73
|
+
path=("prompts", prompt_id),
|
|
94
74
|
value=prompt_id,
|
|
95
75
|
)
|
|
96
76
|
return self
|
|
@@ -104,7 +84,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
104
84
|
self._add_patch(
|
|
105
85
|
FormInfo.ASPECT_NAME,
|
|
106
86
|
"add",
|
|
107
|
-
path="
|
|
87
|
+
path=("actors", "owners"),
|
|
108
88
|
value=is_ownership,
|
|
109
89
|
)
|
|
110
90
|
return self
|
|
@@ -113,7 +93,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
113
93
|
self._add_patch(
|
|
114
94
|
FormInfo.ASPECT_NAME,
|
|
115
95
|
"add",
|
|
116
|
-
path=
|
|
96
|
+
path=("actors", "users", user_urn),
|
|
117
97
|
value=user_urn,
|
|
118
98
|
)
|
|
119
99
|
return self
|
|
@@ -122,7 +102,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
122
102
|
self._add_patch(
|
|
123
103
|
FormInfo.ASPECT_NAME,
|
|
124
104
|
"remove",
|
|
125
|
-
path=
|
|
105
|
+
path=("actors", "users", user_urn),
|
|
126
106
|
value=user_urn,
|
|
127
107
|
)
|
|
128
108
|
return self
|
|
@@ -131,7 +111,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
131
111
|
self._add_patch(
|
|
132
112
|
FormInfo.ASPECT_NAME,
|
|
133
113
|
"add",
|
|
134
|
-
path=
|
|
114
|
+
path=("actors", "groups", group_urn),
|
|
135
115
|
value=group_urn,
|
|
136
116
|
)
|
|
137
117
|
return self
|
|
@@ -140,7 +120,7 @@ class FormPatchBuilder(MetadataPatchProposal):
|
|
|
140
120
|
self._add_patch(
|
|
141
121
|
FormInfo.ASPECT_NAME,
|
|
142
122
|
"remove",
|
|
143
|
-
path=
|
|
123
|
+
path=("actors", "groups", group_urn),
|
|
144
124
|
value=group_urn,
|
|
145
125
|
)
|
|
146
126
|
return self
|
|
@@ -29,7 +29,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
29
29
|
self._add_patch(
|
|
30
30
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
31
31
|
"add",
|
|
32
|
-
path="
|
|
32
|
+
path=("qualifiedName",),
|
|
33
33
|
value=qualified_name,
|
|
34
34
|
)
|
|
35
35
|
return self
|
|
@@ -41,7 +41,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
41
41
|
self._add_patch(
|
|
42
42
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
43
43
|
"add",
|
|
44
|
-
path="
|
|
44
|
+
path=("displayName",),
|
|
45
45
|
value=display_name,
|
|
46
46
|
)
|
|
47
47
|
return self
|
|
@@ -53,7 +53,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
53
53
|
self._add_patch(
|
|
54
54
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
55
55
|
"add",
|
|
56
|
-
path="
|
|
56
|
+
path=("valueType",),
|
|
57
57
|
value=value_type,
|
|
58
58
|
)
|
|
59
59
|
return self
|
|
@@ -66,7 +66,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
66
66
|
self._add_patch(
|
|
67
67
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
68
68
|
"add",
|
|
69
|
-
path="
|
|
69
|
+
path=("typeQualifier",),
|
|
70
70
|
value=type_qualifier,
|
|
71
71
|
)
|
|
72
72
|
return self
|
|
@@ -78,7 +78,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
78
78
|
self._add_patch(
|
|
79
79
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
80
80
|
"add",
|
|
81
|
-
path=
|
|
81
|
+
path=("allowedValues", str(allowed_value.get("value"))),
|
|
82
82
|
value=allowed_value,
|
|
83
83
|
)
|
|
84
84
|
return self
|
|
@@ -87,7 +87,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
87
87
|
self._add_patch(
|
|
88
88
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
89
89
|
"add",
|
|
90
|
-
path="
|
|
90
|
+
path=("cardinality",),
|
|
91
91
|
value=cardinality,
|
|
92
92
|
)
|
|
93
93
|
return self
|
|
@@ -98,7 +98,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
98
98
|
self._add_patch(
|
|
99
99
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
100
100
|
"add",
|
|
101
|
-
path=
|
|
101
|
+
path=("entityTypes", str(entity_type)),
|
|
102
102
|
value=entity_type,
|
|
103
103
|
)
|
|
104
104
|
return self
|
|
@@ -110,7 +110,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
110
110
|
self._add_patch(
|
|
111
111
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
112
112
|
"add",
|
|
113
|
-
path="
|
|
113
|
+
path=("description",),
|
|
114
114
|
value=description,
|
|
115
115
|
)
|
|
116
116
|
return self
|
|
@@ -119,7 +119,7 @@ class StructuredPropertyPatchBuilder(MetadataPatchProposal):
|
|
|
119
119
|
self._add_patch(
|
|
120
120
|
StructuredPropertyDefinition.ASPECT_NAME,
|
|
121
121
|
"add",
|
|
122
|
-
path="
|
|
122
|
+
path=("immutable",),
|
|
123
123
|
value=immutable,
|
|
124
124
|
)
|
|
125
125
|
return self
|
|
@@ -198,7 +198,7 @@ class TableSwap:
|
|
|
198
198
|
|
|
199
199
|
@dataclasses.dataclass
|
|
200
200
|
class PreparsedQuery:
|
|
201
|
-
# If not provided, we will generate one using the
|
|
201
|
+
# If not provided, we will generate one using the fingerprint generator.
|
|
202
202
|
query_id: Optional[QueryId]
|
|
203
203
|
|
|
204
204
|
query_text: str
|
|
@@ -622,7 +622,6 @@ class SqlParsingAggregator(Closeable):
|
|
|
622
622
|
query_fingerprint = get_query_fingerprint(
|
|
623
623
|
known_query_lineage.query_text,
|
|
624
624
|
platform=self.platform.platform_name,
|
|
625
|
-
fast=True,
|
|
626
625
|
)
|
|
627
626
|
formatted_query = self._maybe_format_query(known_query_lineage.query_text)
|
|
628
627
|
|
|
@@ -848,7 +847,6 @@ class SqlParsingAggregator(Closeable):
|
|
|
848
847
|
query_fingerprint = get_query_fingerprint(
|
|
849
848
|
parsed.query_text,
|
|
850
849
|
platform=self.platform.platform_name,
|
|
851
|
-
fast=True,
|
|
852
850
|
)
|
|
853
851
|
|
|
854
852
|
# Format the query.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
from typing import Generic, TypeVar
|
|
2
|
-
|
|
3
|
-
from datahub.emitter.mcp_patch_builder import MetadataPatchProposal
|
|
4
|
-
|
|
5
|
-
_Parent = TypeVar("_Parent", bound=MetadataPatchProposal)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class CustomPropertiesPatchHelper(Generic[_Parent]):
|
|
9
|
-
def __init__(
|
|
10
|
-
self,
|
|
11
|
-
parent: _Parent,
|
|
12
|
-
aspect_name: str,
|
|
13
|
-
) -> None:
|
|
14
|
-
self.aspect_name = aspect_name
|
|
15
|
-
self._parent = parent
|
|
16
|
-
self.aspect_field = "customProperties"
|
|
17
|
-
|
|
18
|
-
def parent(self) -> _Parent:
|
|
19
|
-
return self._parent
|
|
20
|
-
|
|
21
|
-
def add_property(self, key: str, value: str) -> "CustomPropertiesPatchHelper":
|
|
22
|
-
self._parent._add_patch(
|
|
23
|
-
self.aspect_name,
|
|
24
|
-
"add",
|
|
25
|
-
path=f"/{self.aspect_field}/{key}",
|
|
26
|
-
value=value,
|
|
27
|
-
)
|
|
28
|
-
return self
|
|
29
|
-
|
|
30
|
-
def remove_property(self, key: str) -> "CustomPropertiesPatchHelper":
|
|
31
|
-
self._parent._add_patch(
|
|
32
|
-
self.aspect_name,
|
|
33
|
-
"remove",
|
|
34
|
-
path=f"/{self.aspect_field}/{key}",
|
|
35
|
-
value={},
|
|
36
|
-
)
|
|
37
|
-
return self
|
datahub/specific/ownership.py
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
from typing import Generic, List, Optional, TypeVar
|
|
2
|
-
|
|
3
|
-
from datahub.emitter.mcp_patch_builder import MetadataPatchProposal
|
|
4
|
-
from datahub.metadata.schema_classes import (
|
|
5
|
-
OwnerClass,
|
|
6
|
-
OwnershipClass,
|
|
7
|
-
OwnershipTypeClass,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
_Parent = TypeVar("_Parent", bound=MetadataPatchProposal)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class OwnershipPatchHelper(Generic[_Parent]):
|
|
14
|
-
def __init__(self, parent: _Parent) -> None:
|
|
15
|
-
self._parent = parent
|
|
16
|
-
self.aspect_field = OwnershipClass.ASPECT_NAME
|
|
17
|
-
|
|
18
|
-
def parent(self) -> _Parent:
|
|
19
|
-
return self._parent
|
|
20
|
-
|
|
21
|
-
def add_owner(self, owner: OwnerClass) -> "OwnershipPatchHelper":
|
|
22
|
-
self._parent._add_patch(
|
|
23
|
-
OwnershipClass.ASPECT_NAME,
|
|
24
|
-
"add",
|
|
25
|
-
path=f"/owners/{owner.owner}/{owner.type}",
|
|
26
|
-
value=owner,
|
|
27
|
-
)
|
|
28
|
-
return self
|
|
29
|
-
|
|
30
|
-
def remove_owner(
|
|
31
|
-
self, owner: str, owner_type: Optional[OwnershipTypeClass] = None
|
|
32
|
-
) -> "OwnershipPatchHelper":
|
|
33
|
-
"""
|
|
34
|
-
param: owner_type is optional
|
|
35
|
-
"""
|
|
36
|
-
self._parent._add_patch(
|
|
37
|
-
OwnershipClass.ASPECT_NAME,
|
|
38
|
-
"remove",
|
|
39
|
-
path=f"/owners/{owner}" + (f"/{owner_type}" if owner_type else ""),
|
|
40
|
-
value=owner,
|
|
41
|
-
)
|
|
42
|
-
return self
|
|
43
|
-
|
|
44
|
-
def set_owners(self, owners: List[OwnerClass]) -> "OwnershipPatchHelper":
|
|
45
|
-
self._parent._add_patch(
|
|
46
|
-
OwnershipClass.ASPECT_NAME, "add", path="/owners", value=owners
|
|
47
|
-
)
|
|
48
|
-
return self
|