acryl-datahub 0.15.0.1rc13__py3-none-any.whl → 0.15.0.1rc14__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.

Files changed (30) hide show
  1. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc14.dist-info}/METADATA +2520 -2520
  2. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc14.dist-info}/RECORD +27 -24
  3. datahub/__init__.py +1 -1
  4. datahub/emitter/mce_builder.py +3 -3
  5. datahub/emitter/mcp_patch_builder.py +36 -12
  6. datahub/ingestion/source/bigquery_v2/bigquery.py +10 -18
  7. datahub/ingestion/source/bigquery_v2/bigquery_config.py +3 -9
  8. datahub/ingestion/source/bigquery_v2/bigquery_schema_gen.py +11 -17
  9. datahub/ingestion/source/bigquery_v2/lineage.py +9 -22
  10. datahub/ingestion/source/tableau/tableau.py +3 -0
  11. datahub/ingestion/source/tableau/tableau_common.py +18 -0
  12. datahub/specific/aspect_helpers/__init__.py +0 -0
  13. datahub/specific/aspect_helpers/custom_properties.py +79 -0
  14. datahub/specific/aspect_helpers/ownership.py +67 -0
  15. datahub/specific/aspect_helpers/structured_properties.py +72 -0
  16. datahub/specific/aspect_helpers/tags.py +42 -0
  17. datahub/specific/aspect_helpers/terms.py +43 -0
  18. datahub/specific/chart.py +28 -184
  19. datahub/specific/dashboard.py +31 -196
  20. datahub/specific/datajob.py +34 -189
  21. datahub/specific/dataproduct.py +24 -86
  22. datahub/specific/dataset.py +48 -133
  23. datahub/specific/form.py +12 -32
  24. datahub/specific/structured_property.py +9 -9
  25. datahub/specific/custom_properties.py +0 -37
  26. datahub/specific/ownership.py +0 -48
  27. datahub/specific/structured_properties.py +0 -53
  28. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc14.dist-info}/WHEEL +0 -0
  29. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc14.dist-info}/entry_points.txt +0 -0
  30. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc14.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,25 @@
1
- from typing import Dict, List, Optional, Union
1
+ from typing import List, Optional, Tuple
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
  DataProductAssociationClass as DataProductAssociation,
6
6
  DataProductPropertiesClass as DataProductProperties,
7
- GlobalTagsClass as GlobalTags,
8
- GlossaryTermAssociationClass as Term,
9
- GlossaryTermsClass as GlossaryTerms,
10
7
  KafkaAuditHeaderClass,
11
- OwnerClass as Owner,
12
- OwnershipTypeClass,
13
8
  SystemMetadataClass,
14
- TagAssociationClass as Tag,
15
9
  )
16
- from datahub.specific.custom_properties import CustomPropertiesPatchHelper
17
- from datahub.specific.ownership import OwnershipPatchHelper
18
- from datahub.utilities.urns.tag_urn import TagUrn
19
- from datahub.utilities.urns.urn import Urn
20
-
21
-
22
- class DataProductPatchBuilder(MetadataPatchProposal):
10
+ from datahub.specific.aspect_helpers.custom_properties import HasCustomPropertiesPatch
11
+ from datahub.specific.aspect_helpers.ownership import HasOwnershipPatch
12
+ from datahub.specific.aspect_helpers.tags import HasTagsPatch
13
+ from datahub.specific.aspect_helpers.terms import HasTermsPatch
14
+
15
+
16
+ class DataProductPatchBuilder(
17
+ HasOwnershipPatch,
18
+ HasCustomPropertiesPatch,
19
+ HasTagsPatch,
20
+ HasTermsPatch,
21
+ MetadataPatchProposal,
22
+ ):
23
23
  def __init__(
24
24
  self,
25
25
  urn: str,
@@ -31,59 +31,16 @@ class DataProductPatchBuilder(MetadataPatchProposal):
31
31
  system_metadata=system_metadata,
32
32
  audit_header=audit_header,
33
33
  )
34
- self.custom_properties_patch_helper = CustomPropertiesPatchHelper(
35
- self, DataProductProperties.ASPECT_NAME
36
- )
37
- self.ownership_patch_helper = OwnershipPatchHelper(self)
38
-
39
- def add_owner(self, owner: Owner) -> "DataProductPatchBuilder":
40
- self.ownership_patch_helper.add_owner(owner)
41
- return self
42
-
43
- def remove_owner(
44
- self, owner: str, owner_type: Optional[OwnershipTypeClass] = None
45
- ) -> "DataProductPatchBuilder":
46
- """
47
- param: owner_type is optional
48
- """
49
- self.ownership_patch_helper.remove_owner(owner, owner_type)
50
- return self
51
-
52
- def set_owners(self, owners: List[Owner]) -> "DataProductPatchBuilder":
53
- self.ownership_patch_helper.set_owners(owners)
54
- return self
55
-
56
- def add_tag(self, tag: Tag) -> "DataProductPatchBuilder":
57
- self._add_patch(
58
- GlobalTags.ASPECT_NAME, "add", path=f"/tags/{tag.tag}", value=tag
59
- )
60
- return self
61
-
62
- def remove_tag(self, tag: Union[str, Urn]) -> "DataProductPatchBuilder":
63
- if isinstance(tag, str) and not tag.startswith("urn:li:tag:"):
64
- tag = TagUrn.create_from_id(tag)
65
- self._add_patch(GlobalTags.ASPECT_NAME, "remove", path=f"/tags/{tag}", value={})
66
- return self
67
-
68
- def add_term(self, term: Term) -> "DataProductPatchBuilder":
69
- self._add_patch(
70
- GlossaryTerms.ASPECT_NAME, "add", path=f"/terms/{term.urn}", value=term
71
- )
72
- return self
73
34
 
74
- def remove_term(self, term: Union[str, Urn]) -> "DataProductPatchBuilder":
75
- if isinstance(term, str) and not term.startswith("urn:li:glossaryTerm:"):
76
- term = "urn:li:glossaryTerm:" + term
77
- self._add_patch(
78
- GlossaryTerms.ASPECT_NAME, "remove", path=f"/terms/{term}", value={}
79
- )
80
- return self
35
+ @classmethod
36
+ def _custom_properties_location(cls) -> Tuple[str, PatchPath]:
37
+ return DataProductProperties.ASPECT_NAME, ("customProperties",)
81
38
 
82
39
  def set_name(self, name: str) -> "DataProductPatchBuilder":
83
40
  self._add_patch(
84
41
  DataProductProperties.ASPECT_NAME,
85
42
  "add",
86
- path="/name",
43
+ path=("name",),
87
44
  value=name,
88
45
  )
89
46
  return self
@@ -92,37 +49,18 @@ class DataProductPatchBuilder(MetadataPatchProposal):
92
49
  self._add_patch(
93
50
  DataProductProperties.ASPECT_NAME,
94
51
  "add",
95
- path="/description",
52
+ path=("description",),
96
53
  value=description,
97
54
  )
98
55
  return self
99
56
 
100
- def set_custom_properties(
101
- self, custom_properties: Dict[str, str]
102
- ) -> "DataProductPatchBuilder":
103
- self._add_patch(
104
- DataProductProperties.ASPECT_NAME,
105
- "add",
106
- path="/customProperties",
107
- value=custom_properties,
108
- )
109
- return self
110
-
111
- def add_custom_property(self, key: str, value: str) -> "DataProductPatchBuilder":
112
- self.custom_properties_patch_helper.add_property(key, value)
113
- return self
114
-
115
- def remove_custom_property(self, key: str) -> "DataProductPatchBuilder":
116
- self.custom_properties_patch_helper.remove_property(key)
117
- return self
118
-
119
57
  def set_assets(
120
58
  self, assets: List[DataProductAssociation]
121
59
  ) -> "DataProductPatchBuilder":
122
60
  self._add_patch(
123
61
  DataProductProperties.ASPECT_NAME,
124
62
  "add",
125
- path="/assets",
63
+ path=("assets",),
126
64
  value=assets,
127
65
  )
128
66
  return self
@@ -131,7 +69,7 @@ class DataProductPatchBuilder(MetadataPatchProposal):
131
69
  self._add_patch(
132
70
  DataProductProperties.ASPECT_NAME,
133
71
  "add",
134
- path=f"/assets/{self.quote(asset_urn)}",
72
+ path=("assets", asset_urn),
135
73
  value=DataProductAssociation(destinationUrn=asset_urn),
136
74
  )
137
75
  return self
@@ -140,7 +78,7 @@ class DataProductPatchBuilder(MetadataPatchProposal):
140
78
  self._add_patch(
141
79
  DataProductProperties.ASPECT_NAME,
142
80
  "remove",
143
- path=f"/assets/{self.quote(asset_urn)}",
81
+ path=("assets", asset_urn),
144
82
  value={},
145
83
  )
146
84
  return self
@@ -149,7 +87,7 @@ class DataProductPatchBuilder(MetadataPatchProposal):
149
87
  self._add_patch(
150
88
  DataProductProperties.ASPECT_NAME,
151
89
  "add",
152
- path="/externalUrl",
90
+ path=("externalUrl",),
153
91
  value=external_url,
154
92
  )
155
93
  return self
@@ -1,27 +1,27 @@
1
- from typing import Dict, Generic, List, Optional, Tuple, TypeVar, Union
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 CustomPropertiesPatchHelper
23
- from datahub.specific.ownership import OwnershipPatchHelper
24
- from datahub.specific.structured_properties import StructuredPropertiesPatchHelper
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=f"/{self.aspect_field}/{self.field_path}/globalTags/tags/{tag.tag}",
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=f"/{self.aspect_field}/{self.field_path}/globalTags/tags/{tag}",
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=f"/{self.aspect_field}/{self.field_path}/glossaryTerms/terms/{term.urn}",
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=f"/{self.aspect_field}/{self.field_path}/glossaryTerms/terms/{term}",
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(MetadataPatchProposal):
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
- def remove_owner(
112
- self, owner: str, owner_type: Optional[OwnershipTypeClass] = None
113
- ) -> "DatasetPatchBuilder":
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=f"/upstreams/{self.quote(upstream.dataset)}",
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=f"/upstreams/{dataset}",
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="/upstreams", value=upstreams
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=DatasetPatchBuilder.quote_fine_grained_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 quote_fine_grained_path(
177
+ def _build_fine_grained_path(
183
178
  cls, transform_op: str, downstream_urn: str, query_id: str, upstream_urn: str
184
- ) -> str:
179
+ ) -> PatchPath:
185
180
  return (
186
- f"/fineGrainedLineages/{cls.quote(transform_op)}/"
187
- f"{cls.quote(downstream_urn)}/{cls.quote(query_id)}/{cls.quote(upstream_urn)}"
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=DatasetPatchBuilder.quote_fine_grained_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="/fineGrainedLineages",
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="/description",
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="/name",
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="/qualifiedName",
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="/created",
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="/lastModified",
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 OwnershipPatchHelper
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="/name",
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="/description",
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="/type",
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=f"/prompts/{self.quote(prompt.id)}",
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=f"/prompts/{self.quote(prompt_id)}",
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="/actors/owners",
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=f"/actors/users/{self.quote(str(user_urn))}",
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=f"/actors/users/{self.quote(str(user_urn))}",
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=f"/actors/groups/{self.quote(str(group_urn))}",
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=f"/actors/groups/{self.quote(str(group_urn))}",
123
+ path=("actors", "groups", group_urn),
144
124
  value=group_urn,
145
125
  )
146
126
  return self