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.

Files changed (36) hide show
  1. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/METADATA +2413 -2413
  2. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/RECORD +33 -30
  3. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/WHEEL +1 -1
  4. datahub/__init__.py +1 -1
  5. datahub/emitter/mce_builder.py +3 -3
  6. datahub/emitter/mcp_patch_builder.py +36 -12
  7. datahub/ingestion/source/bigquery_v2/bigquery.py +10 -18
  8. datahub/ingestion/source/bigquery_v2/bigquery_config.py +3 -9
  9. datahub/ingestion/source/bigquery_v2/bigquery_schema_gen.py +11 -17
  10. datahub/ingestion/source/bigquery_v2/lineage.py +9 -22
  11. datahub/ingestion/source/gc/datahub_gc.py +3 -0
  12. datahub/ingestion/source/gc/execution_request_cleanup.py +13 -5
  13. datahub/ingestion/source/gc/soft_deleted_entity_cleanup.py +28 -21
  14. datahub/ingestion/source/snowflake/snowflake_queries.py +6 -4
  15. datahub/ingestion/source/tableau/tableau.py +53 -18
  16. datahub/ingestion/source/tableau/tableau_common.py +18 -0
  17. datahub/ingestion/source/usage/usage_common.py +15 -1
  18. datahub/specific/aspect_helpers/__init__.py +0 -0
  19. datahub/specific/aspect_helpers/custom_properties.py +79 -0
  20. datahub/specific/aspect_helpers/ownership.py +67 -0
  21. datahub/specific/aspect_helpers/structured_properties.py +72 -0
  22. datahub/specific/aspect_helpers/tags.py +42 -0
  23. datahub/specific/aspect_helpers/terms.py +43 -0
  24. datahub/specific/chart.py +28 -184
  25. datahub/specific/dashboard.py +31 -196
  26. datahub/specific/datajob.py +34 -189
  27. datahub/specific/dataproduct.py +24 -86
  28. datahub/specific/dataset.py +48 -133
  29. datahub/specific/form.py +12 -32
  30. datahub/specific/structured_property.py +9 -9
  31. datahub/sql_parsing/sql_parsing_aggregator.py +1 -3
  32. datahub/specific/custom_properties.py +0 -37
  33. datahub/specific/ownership.py +0 -48
  34. datahub/specific/structured_properties.py +0 -53
  35. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/entry_points.txt +0 -0
  36. {acryl_datahub-0.15.0.1rc13.dist-info → acryl_datahub-0.15.0.1rc15.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,27 @@
1
- from typing import Dict, List, Optional, Union
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
  DataJobInfoClass as DataJobInfo,
6
6
  DataJobInputOutputClass as DataJobInputOutput,
7
7
  EdgeClass as Edge,
8
- GlobalTagsClass as GlobalTags,
9
- GlossaryTermAssociationClass as Term,
10
- GlossaryTermsClass as GlossaryTerms,
11
8
  KafkaAuditHeaderClass,
12
- OwnerClass as Owner,
13
- OwnershipTypeClass,
14
9
  SystemMetadataClass,
15
- TagAssociationClass as Tag,
16
10
  )
17
- from datahub.metadata.urns import SchemaFieldUrn, TagUrn, Urn
18
- from datahub.specific.custom_properties import CustomPropertiesPatchHelper
19
- from datahub.specific.ownership import OwnershipPatchHelper
20
-
21
-
22
- class DataJobPatchBuilder(MetadataPatchProposal):
11
+ from datahub.metadata.urns import SchemaFieldUrn, Urn
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
16
+
17
+
18
+ class DataJobPatchBuilder(
19
+ HasOwnershipPatch,
20
+ HasCustomPropertiesPatch,
21
+ HasTagsPatch,
22
+ HasTermsPatch,
23
+ MetadataPatchProposal,
24
+ ):
23
25
  def __init__(
24
26
  self,
25
27
  urn: str,
@@ -37,55 +39,10 @@ class DataJobPatchBuilder(MetadataPatchProposal):
37
39
  super().__init__(
38
40
  urn, system_metadata=system_metadata, audit_header=audit_header
39
41
  )
40
- self.custom_properties_patch_helper = CustomPropertiesPatchHelper(
41
- self, DataJobInfo.ASPECT_NAME
42
- )
43
- self.ownership_patch_helper = OwnershipPatchHelper(self)
44
-
45
- def add_owner(self, owner: Owner) -> "DataJobPatchBuilder":
46
- """
47
- Adds an owner to the DataJobPatchBuilder.
48
-
49
- Args:
50
- owner: The Owner object to add.
51
-
52
- Returns:
53
- The DataJobPatchBuilder instance.
54
- """
55
- self.ownership_patch_helper.add_owner(owner)
56
- return self
57
-
58
- def remove_owner(
59
- self, owner: str, owner_type: Optional[OwnershipTypeClass] = None
60
- ) -> "DataJobPatchBuilder":
61
- """
62
- Removes an owner from the DataJobPatchBuilder.
63
-
64
- Args:
65
- owner: The owner to remove.
66
- owner_type: The ownership type of the owner (optional).
67
-
68
- Returns:
69
- The DataJobPatchBuilder instance.
70
-
71
- Notes:
72
- `owner_type` is optional.
73
- """
74
- self.ownership_patch_helper.remove_owner(owner, owner_type)
75
- return self
76
-
77
- def set_owners(self, owners: List[Owner]) -> "DataJobPatchBuilder":
78
- """
79
- Sets the owners of the DataJobPatchBuilder.
80
-
81
- Args:
82
- owners: A list of Owner objects.
83
42
 
84
- Returns:
85
- The DataJobPatchBuilder instance.
86
- """
87
- self.ownership_patch_helper.set_owners(owners)
88
- return self
43
+ @classmethod
44
+ def _custom_properties_location(cls) -> Tuple[str, PatchPath]:
45
+ return DataJobInfo.ASPECT_NAME, ("customProperties",)
89
46
 
90
47
  def add_input_datajob(self, input: Union[Edge, Urn, str]) -> "DataJobPatchBuilder":
91
48
  """
@@ -120,7 +77,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
120
77
  self._add_patch(
121
78
  DataJobInputOutput.ASPECT_NAME,
122
79
  "add",
123
- path=f"/inputDatajobEdges/{self.quote(input_urn)}",
80
+ path=("inputDatajobEdges", input_urn),
124
81
  value=input_edge,
125
82
  )
126
83
  return self
@@ -138,7 +95,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
138
95
  self._add_patch(
139
96
  DataJobInputOutput.ASPECT_NAME,
140
97
  "remove",
141
- path=f"/inputDatajobEdges/{input}",
98
+ path=("inputDatajobEdges", input),
142
99
  value={},
143
100
  )
144
101
  return self
@@ -163,7 +120,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
163
120
  self._add_patch(
164
121
  DataJobInputOutput.ASPECT_NAME,
165
122
  "add",
166
- path="/inputDatajobEdges",
123
+ path=("inputDatajobEdges",),
167
124
  value=inputs,
168
125
  )
169
126
  return self
@@ -201,7 +158,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
201
158
  self._add_patch(
202
159
  DataJobInputOutput.ASPECT_NAME,
203
160
  "add",
204
- path=f"/inputDatasetEdges/{self.quote(input_urn)}",
161
+ path=("inputDatasetEdges", input_urn),
205
162
  value=input_edge,
206
163
  )
207
164
  return self
@@ -219,7 +176,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
219
176
  self._add_patch(
220
177
  DataJobInputOutput.ASPECT_NAME,
221
178
  "remove",
222
- path=f"/inputDatasetEdges/{self.quote(str(input))}",
179
+ path=("inputDatasetEdges", input),
223
180
  value={},
224
181
  )
225
182
  return self
@@ -244,7 +201,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
244
201
  self._add_patch(
245
202
  DataJobInputOutput.ASPECT_NAME,
246
203
  "add",
247
- path="/inputDatasetEdges",
204
+ path=("inputDatasetEdges",),
248
205
  value=inputs,
249
206
  )
250
207
  return self
@@ -284,7 +241,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
284
241
  self._add_patch(
285
242
  DataJobInputOutput.ASPECT_NAME,
286
243
  "add",
287
- path=f"/outputDatasetEdges/{self.quote(output_urn)}",
244
+ path=("outputDatasetEdges", output_urn),
288
245
  value=output_edge,
289
246
  )
290
247
  return self
@@ -302,7 +259,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
302
259
  self._add_patch(
303
260
  DataJobInputOutput.ASPECT_NAME,
304
261
  "remove",
305
- path=f"/outputDatasetEdges/{self.quote(str(output))}",
262
+ path=("outputDatasetEdges", output),
306
263
  value={},
307
264
  )
308
265
  return self
@@ -327,7 +284,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
327
284
  self._add_patch(
328
285
  DataJobInputOutput.ASPECT_NAME,
329
286
  "add",
330
- path="/outputDatasetEdges",
287
+ path=("outputDatasetEdges",),
331
288
  value=outputs,
332
289
  )
333
290
  return self
@@ -351,7 +308,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
351
308
  self._add_patch(
352
309
  DataJobInputOutput.ASPECT_NAME,
353
310
  "add",
354
- path=f"/inputDatasetFields/{self.quote(input_urn)}",
311
+ path=("inputDatasetFields", input_urn),
355
312
  value={},
356
313
  )
357
314
  return self
@@ -372,7 +329,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
372
329
  self._add_patch(
373
330
  DataJobInputOutput.ASPECT_NAME,
374
331
  "remove",
375
- path=f"/inputDatasetFields/{self.quote(input_urn)}",
332
+ path=("inputDatasetFields", input_urn),
376
333
  value={},
377
334
  )
378
335
  return self
@@ -397,7 +354,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
397
354
  self._add_patch(
398
355
  DataJobInputOutput.ASPECT_NAME,
399
356
  "add",
400
- path="/inputDatasetFields",
357
+ path=("inputDatasetFields",),
401
358
  value=inputs,
402
359
  )
403
360
  return self
@@ -423,7 +380,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
423
380
  self._add_patch(
424
381
  DataJobInputOutput.ASPECT_NAME,
425
382
  "add",
426
- path=f"/outputDatasetFields/{self.quote(output_urn)}",
383
+ path=("outputDatasetFields", output_urn),
427
384
  value={},
428
385
  )
429
386
  return self
@@ -444,7 +401,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
444
401
  self._add_patch(
445
402
  DataJobInputOutput.ASPECT_NAME,
446
403
  "remove",
447
- path=f"/outputDatasetFields/{self.quote(output_urn)}",
404
+ path=("outputDatasetFields", output_urn),
448
405
  value={},
449
406
  )
450
407
  return self
@@ -469,119 +426,7 @@ class DataJobPatchBuilder(MetadataPatchProposal):
469
426
  self._add_patch(
470
427
  DataJobInputOutput.ASPECT_NAME,
471
428
  "add",
472
- path="/outputDatasetFields",
429
+ path=("outputDatasetFields",),
473
430
  value=outputs,
474
431
  )
475
432
  return self
476
-
477
- def add_tag(self, tag: Tag) -> "DataJobPatchBuilder":
478
- """
479
- Adds a tag to the DataJobPatchBuilder.
480
-
481
- Args:
482
- tag: The Tag object representing the tag to be added.
483
-
484
- Returns:
485
- The DataJobPatchBuilder instance.
486
- """
487
- self._add_patch(
488
- GlobalTags.ASPECT_NAME, "add", path=f"/tags/{tag.tag}", value=tag
489
- )
490
- return self
491
-
492
- def remove_tag(self, tag: Union[str, Urn]) -> "DataJobPatchBuilder":
493
- """
494
- Removes a tag from the DataJobPatchBuilder.
495
-
496
- Args:
497
- tag: The tag to remove, specified as a string or Urn object.
498
-
499
- Returns:
500
- The DataJobPatchBuilder instance.
501
- """
502
- if isinstance(tag, str) and not tag.startswith("urn:li:tag:"):
503
- tag = TagUrn.create_from_id(tag)
504
- self._add_patch(GlobalTags.ASPECT_NAME, "remove", path=f"/tags/{tag}", value={})
505
- return self
506
-
507
- def add_term(self, term: Term) -> "DataJobPatchBuilder":
508
- """
509
- Adds a glossary term to the DataJobPatchBuilder.
510
-
511
- Args:
512
- term: The Term object representing the glossary term to be added.
513
-
514
- Returns:
515
- The DataJobPatchBuilder instance.
516
- """
517
- self._add_patch(
518
- GlossaryTerms.ASPECT_NAME, "add", path=f"/terms/{term.urn}", value=term
519
- )
520
- return self
521
-
522
- def remove_term(self, term: Union[str, Urn]) -> "DataJobPatchBuilder":
523
- """
524
- Removes a glossary term from the DataJobPatchBuilder.
525
-
526
- Args:
527
- term: The term to remove, specified as a string or Urn object.
528
-
529
- Returns:
530
- The DataJobPatchBuilder instance.
531
- """
532
- if isinstance(term, str) and not term.startswith("urn:li:glossaryTerm:"):
533
- term = "urn:li:glossaryTerm:" + term
534
- self._add_patch(
535
- GlossaryTerms.ASPECT_NAME, "remove", path=f"/terms/{term}", value={}
536
- )
537
- return self
538
-
539
- def set_custom_properties(
540
- self, custom_properties: Dict[str, str]
541
- ) -> "DataJobPatchBuilder":
542
- """
543
- Sets the custom properties for the DataJobPatchBuilder.
544
-
545
- Args:
546
- custom_properties: A dictionary containing the custom properties to be set.
547
-
548
- Returns:
549
- The DataJobPatchBuilder instance.
550
-
551
- Notes:
552
- This method replaces all existing custom properties with the given dictionary.
553
- """
554
- self._add_patch(
555
- DataJobInfo.ASPECT_NAME,
556
- "add",
557
- path="/customProperties",
558
- value=custom_properties,
559
- )
560
- return self
561
-
562
- def add_custom_property(self, key: str, value: str) -> "DataJobPatchBuilder":
563
- """
564
- Adds a custom property to the DataJobPatchBuilder.
565
-
566
- Args:
567
- key: The key of the custom property.
568
- value: The value of the custom property.
569
-
570
- Returns:
571
- The DataJobPatchBuilder instance.
572
- """
573
- self.custom_properties_patch_helper.add_property(key, value)
574
- return self
575
-
576
- def remove_custom_property(self, key: str) -> "DataJobPatchBuilder":
577
- """
578
- Removes a custom property from the DataJobPatchBuilder.
579
-
580
- Args:
581
- key: The key of the custom property to remove.
582
-
583
- Returns:
584
- The DataJobPatchBuilder instance.
585
- """
586
- self.custom_properties_patch_helper.remove_property(key)
587
- return self
@@ -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