acryl-datahub-cloud 0.3.6.10__py3-none-any.whl → 0.3.7__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.
Files changed (66) hide show
  1. acryl_datahub_cloud/_codegen_config.json +1 -1
  2. acryl_datahub_cloud/datahub_reporting/extract_graph.py +1 -1
  3. acryl_datahub_cloud/datahub_usage_reporting/usage_feature_patch_builder.py +466 -0
  4. acryl_datahub_cloud/datahub_usage_reporting/usage_feature_reporter.py +432 -34
  5. acryl_datahub_cloud/metadata/_urns/urn_defs.py +788 -5
  6. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/actionrequest/__init__.py +2 -0
  7. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/ai/__init__.py +23 -0
  8. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/assertion/__init__.py +4 -0
  9. acryl_datahub_cloud/metadata/com/linkedin/pegasus2avro/structured/__init__.py +2 -0
  10. acryl_datahub_cloud/metadata/schema.avsc +773 -75
  11. acryl_datahub_cloud/metadata/schema_classes.py +750 -20
  12. acryl_datahub_cloud/metadata/schemas/Access.avsc +2 -1
  13. acryl_datahub_cloud/metadata/schemas/ActionRequestInfo.avsc +76 -0
  14. acryl_datahub_cloud/metadata/schemas/AiInferenceMetadata.avsc +42 -0
  15. acryl_datahub_cloud/metadata/schemas/AnomaliesSummary.avsc +16 -8
  16. acryl_datahub_cloud/metadata/schemas/AssertionAnalyticsRunEvent.avsc +3506 -0
  17. acryl_datahub_cloud/metadata/schemas/AssertionInfo.avsc +3 -2
  18. acryl_datahub_cloud/metadata/schemas/AssertionKey.avsc +2 -0
  19. acryl_datahub_cloud/metadata/schemas/AssertionRunEvent.avsc +4 -3
  20. acryl_datahub_cloud/metadata/schemas/AssertionSummary.avsc +50 -0
  21. acryl_datahub_cloud/metadata/schemas/AssertionsSummary.avsc +54 -8
  22. acryl_datahub_cloud/metadata/schemas/ConstraintInfo.avsc +4 -2
  23. acryl_datahub_cloud/metadata/schemas/ContainerKey.avsc +1 -0
  24. acryl_datahub_cloud/metadata/schemas/ContainerProperties.avsc +3 -1
  25. acryl_datahub_cloud/metadata/schemas/CorpUserInfo.avsc +1 -1
  26. acryl_datahub_cloud/metadata/schemas/DashboardInfo.avsc +29 -2
  27. acryl_datahub_cloud/metadata/schemas/DataFlowInfo.avsc +3 -1
  28. acryl_datahub_cloud/metadata/schemas/DataHubActionInfo.avsc +10 -1
  29. acryl_datahub_cloud/metadata/schemas/DataHubPolicyInfo.avsc +4 -2
  30. acryl_datahub_cloud/metadata/schemas/DataHubViewInfo.avsc +2 -0
  31. acryl_datahub_cloud/metadata/schemas/DataJobInfo.avsc +3 -1
  32. acryl_datahub_cloud/metadata/schemas/DataProcessKey.avsc +3 -1
  33. acryl_datahub_cloud/metadata/schemas/DatasetKey.avsc +5 -2
  34. acryl_datahub_cloud/metadata/schemas/DynamicFormAssignment.avsc +2 -0
  35. acryl_datahub_cloud/metadata/schemas/EntityInferenceMetadata.avsc +47 -0
  36. acryl_datahub_cloud/metadata/schemas/Filter.avsc +2 -0
  37. acryl_datahub_cloud/metadata/schemas/FormInfo.avsc +75 -0
  38. acryl_datahub_cloud/metadata/schemas/Forms.avsc +18 -9
  39. acryl_datahub_cloud/metadata/schemas/GlobalSettingsInfo.avsc +18 -0
  40. acryl_datahub_cloud/metadata/schemas/GlossaryRelatedTerms.avsc +4 -4
  41. acryl_datahub_cloud/metadata/schemas/IncidentActivityEvent.avsc +3 -1
  42. acryl_datahub_cloud/metadata/schemas/IncidentInfo.avsc +3 -1
  43. acryl_datahub_cloud/metadata/schemas/IncidentsSummary.avsc +4 -2
  44. acryl_datahub_cloud/metadata/schemas/InferredMetadata.avsc +4 -2
  45. acryl_datahub_cloud/metadata/schemas/MLFeatureKey.avsc +2 -1
  46. acryl_datahub_cloud/metadata/schemas/MLModelDeploymentKey.avsc +3 -1
  47. acryl_datahub_cloud/metadata/schemas/MLModelGroupKey.avsc +3 -1
  48. acryl_datahub_cloud/metadata/schemas/MLModelKey.avsc +5 -2
  49. acryl_datahub_cloud/metadata/schemas/MetadataChangeEvent.avsc +119 -11
  50. acryl_datahub_cloud/metadata/schemas/MonitorInfo.avsc +3 -2
  51. acryl_datahub_cloud/metadata/schemas/NotificationRequest.avsc +2 -1
  52. acryl_datahub_cloud/metadata/schemas/Operation.avsc +0 -3
  53. acryl_datahub_cloud/metadata/schemas/Ownership.avsc +2 -1
  54. acryl_datahub_cloud/metadata/schemas/PlatformResourceInfo.avsc +2 -2
  55. acryl_datahub_cloud/metadata/schemas/PlatformResourceKey.avsc +4 -3
  56. acryl_datahub_cloud/metadata/schemas/PostInfo.avsc +2 -1
  57. acryl_datahub_cloud/metadata/schemas/RecommendationModule.avsc +2 -0
  58. acryl_datahub_cloud/metadata/schemas/Share.avsc +2 -1
  59. acryl_datahub_cloud/metadata/schemas/StructuredPropertyDefinition.avsc +25 -1
  60. acryl_datahub_cloud/metadata/schemas/SubTypes.avsc +1 -1
  61. acryl_datahub_cloud/metadata/schemas/TestResults.avsc +8 -4
  62. {acryl_datahub_cloud-0.3.6.10.dist-info → acryl_datahub_cloud-0.3.7.dist-info}/METADATA +36 -36
  63. {acryl_datahub_cloud-0.3.6.10.dist-info → acryl_datahub_cloud-0.3.7.dist-info}/RECORD +66 -60
  64. {acryl_datahub_cloud-0.3.6.10.dist-info → acryl_datahub_cloud-0.3.7.dist-info}/WHEEL +1 -1
  65. {acryl_datahub_cloud-0.3.6.10.dist-info → acryl_datahub_cloud-0.3.7.dist-info}/entry_points.txt +0 -0
  66. {acryl_datahub_cloud-0.3.6.10.dist-info → acryl_datahub_cloud-0.3.7.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acryl-datahub-cloud",
3
- "version": "0.3.6.10",
3
+ "version": "0.3.7",
4
4
  "install_requires": [
5
5
  "avro-gen3==0.7.16",
6
6
  "acryl-datahub"
@@ -160,7 +160,7 @@ class DataHubReportingExtractGraphSource(Source):
160
160
  ],
161
161
  }
162
162
 
163
- index = f"{index_prefix}_graph_service_v1"
163
+ index = f"{index_prefix}graph_service_v1"
164
164
  response = server.create_pit(index, keep_alive="10m")
165
165
 
166
166
  # TODO: Save PIT, we can resume processing based on <pit, search_after> tuple
@@ -0,0 +1,466 @@
1
+ from typing import Callable, Dict, List, Optional, Union
2
+
3
+ from acryl_datahub_cloud.metadata.schema_classes import UsageFeaturesClass
4
+ from datahub.emitter.mcp_patch_builder import MetadataPatchProposal
5
+ from datahub.metadata.schema_classes import KafkaAuditHeaderClass, SystemMetadataClass
6
+
7
+
8
+ class UsageFeaturePatchBuilder(MetadataPatchProposal):
9
+ def __init__(
10
+ self,
11
+ urn: str,
12
+ system_metadata: Optional[SystemMetadataClass] = None,
13
+ audit_header: Optional[KafkaAuditHeaderClass] = None,
14
+ ) -> None:
15
+ """Initializes a MonitorPatchBuilder instance.
16
+
17
+ Args:
18
+ urn: The URN of the monitor.
19
+ system_metadata: The system metadata of the data job (optional).
20
+ audit_header: The Kafka audit header of the data job (optional).
21
+ """
22
+ super().__init__(
23
+ urn, system_metadata=system_metadata, audit_header=audit_header
24
+ )
25
+
26
+ def setQueryCountLast30Days(
27
+ self, count: Optional[int]
28
+ ) -> "UsageFeaturePatchBuilder":
29
+ """Sets the query count for the last 30 days.
30
+
31
+ Args:
32
+ count: The query count for the last 30 days.
33
+
34
+ Returns:
35
+ UsageFeaturePatchBuilder: The instance of the builder.
36
+ """
37
+ self._add_patch(
38
+ UsageFeaturesClass.ASPECT_NAME,
39
+ "add",
40
+ path="/queryCountLast30Days",
41
+ value=count,
42
+ )
43
+ return self
44
+
45
+ def setViewCountLast30Days(
46
+ self, count: Optional[int]
47
+ ) -> "UsageFeaturePatchBuilder":
48
+ """Sets the view count for the last 30 days.
49
+
50
+ Args:
51
+ count: The view count for the last 30 days.
52
+
53
+ Returns:
54
+ UsageFeaturePatchBuilder: The instance of the builder.
55
+ """
56
+ self._add_patch(
57
+ UsageFeaturesClass.ASPECT_NAME,
58
+ "add",
59
+ path="/viewCountLast30Days",
60
+ value=count,
61
+ )
62
+ return self
63
+
64
+ def setViewCountTotal(self, count: Optional[int]) -> "UsageFeaturePatchBuilder":
65
+ """Sets the total view count.
66
+
67
+ Args:
68
+ count: The total view count.
69
+
70
+ Returns:
71
+ UsageFeaturePatchBuilder: The instance of the builder.
72
+ """
73
+ self._add_patch(
74
+ UsageFeaturesClass.ASPECT_NAME,
75
+ "add",
76
+ path="/viewCountTotal",
77
+ value=count,
78
+ )
79
+ return self
80
+
81
+ def setViewCountPercentileLast30Days(
82
+ self, count: Optional[int]
83
+ ) -> "UsageFeaturePatchBuilder":
84
+ """Sets the view count percentile for the last 30 days.
85
+
86
+ Args:
87
+ count: The view count percentile for the last 30 days.
88
+
89
+ Returns:
90
+ UsageFeaturePatchBuilder: The instance of the builder.
91
+ """
92
+ self._add_patch(
93
+ UsageFeaturesClass.ASPECT_NAME,
94
+ "add",
95
+ path="/viewCountPercentileLast30Days",
96
+ value=count,
97
+ )
98
+ return self
99
+
100
+ def setUsageCountLast30Days(
101
+ self, count: Optional[int]
102
+ ) -> "UsageFeaturePatchBuilder":
103
+ """Sets the usage count for the last 30 days.
104
+
105
+ Args:
106
+ count: The usage count for the last 30 days.
107
+
108
+ Returns:
109
+ UsageFeaturePatchBuilder: The instance of the builder.
110
+ """
111
+ self._add_patch(
112
+ UsageFeaturesClass.ASPECT_NAME,
113
+ "add",
114
+ path="/usageCountLast30Days",
115
+ value=count,
116
+ )
117
+ return self
118
+
119
+ def setUniqueUserCountLast30Days(
120
+ self, count: Optional[int]
121
+ ) -> "UsageFeaturePatchBuilder":
122
+ """Sets the unique user count for the last 30 days.
123
+
124
+ Args:
125
+ count: The unique user count for the last 30 days.
126
+
127
+ Returns:
128
+ UsageFeaturePatchBuilder: The instance of the builder.
129
+ """
130
+ self._add_patch(
131
+ UsageFeaturesClass.ASPECT_NAME,
132
+ "add",
133
+ path="/uniqueUserCountLast30Days",
134
+ value=count,
135
+ )
136
+ return self
137
+
138
+ def setWriteCountLast30Days(
139
+ self, count: Optional[int]
140
+ ) -> "UsageFeaturePatchBuilder":
141
+ """Sets the write count for the last 30 days.
142
+
143
+ Args:
144
+ count: The write count for the last 30 days.
145
+
146
+ Returns:
147
+ UsageFeaturePatchBuilder: The instance of the builder.
148
+ """
149
+ self._add_patch(
150
+ UsageFeaturesClass.ASPECT_NAME,
151
+ "add",
152
+ path="/writeCountLast30Days",
153
+ value=count,
154
+ )
155
+ return self
156
+
157
+ def setQueryCountPercentileLast30Days(
158
+ self, count: Optional[int]
159
+ ) -> "UsageFeaturePatchBuilder":
160
+ """Sets the query count percentile for the last 30 days.
161
+
162
+ Args:
163
+ count: The query count percentile for the last 30 days.
164
+
165
+ Returns:
166
+ UsageFeaturePatchBuilder: The instance of the builder.
167
+ """
168
+ self._add_patch(
169
+ UsageFeaturesClass.ASPECT_NAME,
170
+ "add",
171
+ path="/queryCountPercentileLast30Days",
172
+ value=count,
173
+ )
174
+ return self
175
+
176
+ def setQueryCountRankLast30Days(
177
+ self, count: Optional[int]
178
+ ) -> "UsageFeaturePatchBuilder":
179
+ """Sets the query count rank for the last 30 days.
180
+
181
+ Args:
182
+ count: The query count rank for the last 30 days.
183
+
184
+ Returns:
185
+ UsageFeaturePatchBuilder: The instance of the builder.
186
+ """
187
+ self._add_patch(
188
+ UsageFeaturesClass.ASPECT_NAME,
189
+ "add",
190
+ path="/queryCountRankLast30Days",
191
+ value=count,
192
+ )
193
+ return self
194
+
195
+ def setUniqueUserPercentileLast30Days(
196
+ self, count: Optional[int]
197
+ ) -> "UsageFeaturePatchBuilder":
198
+ """Sets the unique user percentile for the last 30 days.
199
+
200
+ Args:
201
+ count: The unique user percentile for the last 30 days.
202
+
203
+ Returns:
204
+ UsageFeaturePatchBuilder: The instance of the builder.
205
+ """
206
+ self._add_patch(
207
+ UsageFeaturesClass.ASPECT_NAME,
208
+ "add",
209
+ path="/uniqueUserPercentileLast30Days",
210
+ value=count,
211
+ )
212
+ return self
213
+
214
+ def setUniqueUserRankLast30Days(
215
+ self, count: Optional[int]
216
+ ) -> "UsageFeaturePatchBuilder":
217
+ """Sets the unique user rank for the last 30 days.
218
+
219
+ Args:
220
+ count: The unique user rank for the last 30 days.
221
+
222
+ Returns:
223
+ UsageFeaturePatchBuilder: The instance of the builder.
224
+ """
225
+ self._add_patch(
226
+ UsageFeaturesClass.ASPECT_NAME,
227
+ "add",
228
+ path="/uniqueUserRankLast30Days",
229
+ value=count,
230
+ )
231
+ return self
232
+
233
+ def setWriteCountPercentileLast30Days(
234
+ self, count: Optional[int]
235
+ ) -> "UsageFeaturePatchBuilder":
236
+ """Sets the write count percentile for the last 30 days.
237
+
238
+ Args:
239
+ count: The write count percentile for the last 30 days.
240
+
241
+ Returns:
242
+ UsageFeaturePatchBuilder: The instance of the builder.
243
+ """
244
+ self._add_patch(
245
+ UsageFeaturesClass.ASPECT_NAME,
246
+ "add",
247
+ path="/writeCountPercentileLast30Days",
248
+ value=count,
249
+ )
250
+ return self
251
+
252
+ def setWriteCountRankLast30Days(
253
+ self, count: Optional[int]
254
+ ) -> "UsageFeaturePatchBuilder":
255
+ """Sets the write count rank for the last 30 days.
256
+
257
+ Args:
258
+ count: The write count rank for the last 30 days.
259
+
260
+ Returns:
261
+ UsageFeaturePatchBuilder: The instance of the builder.
262
+ """
263
+ self._add_patch(
264
+ UsageFeaturesClass.ASPECT_NAME,
265
+ "add",
266
+ path="/writeCountRankLast30Days",
267
+ value=count,
268
+ )
269
+ return self
270
+
271
+ def setTopUsersLast30Days(
272
+ self, users: Optional[List[str]]
273
+ ) -> "UsageFeaturePatchBuilder":
274
+ """Sets the top users for the last 30 days.
275
+
276
+ Args:
277
+ users: The list of top users for the last 30 days.
278
+
279
+ Returns:
280
+ UsageFeaturePatchBuilder: The instance of the builder.
281
+ """
282
+ self._add_patch(
283
+ UsageFeaturesClass.ASPECT_NAME,
284
+ "add",
285
+ path="/topUsersLast30Days",
286
+ value=users,
287
+ )
288
+ return self
289
+
290
+ def setSizeInBytesPercentile(
291
+ self, percentile: Optional[int]
292
+ ) -> "UsageFeaturePatchBuilder":
293
+ """Sets the size in bytes percentile.
294
+
295
+ Args:
296
+ percentile: The size in bytes percentile.
297
+
298
+ Returns:
299
+ UsageFeaturePatchBuilder: The instance of the builder.
300
+ """
301
+ self._add_patch(
302
+ UsageFeaturesClass.ASPECT_NAME,
303
+ "add",
304
+ path="/sizeInBytesPercentile",
305
+ value=percentile,
306
+ )
307
+ return self
308
+
309
+ def setSizeInBytesRank(self, rank: Optional[int]) -> "UsageFeaturePatchBuilder":
310
+ """Sets the size in bytes rank.
311
+
312
+ Args:
313
+ rank: The size in bytes rank.
314
+
315
+ Returns:
316
+ UsageFeaturePatchBuilder: The instance of the builder.
317
+ """
318
+ self._add_patch(
319
+ UsageFeaturesClass.ASPECT_NAME,
320
+ "add",
321
+ path="/sizeInBytesRank",
322
+ value=rank,
323
+ )
324
+ return self
325
+
326
+ def setRowCountPercentile(
327
+ self, percentile: Optional[int]
328
+ ) -> "UsageFeaturePatchBuilder":
329
+ """Sets the row count percentile.
330
+
331
+ Args:
332
+ percentile: The row count percentile.
333
+
334
+ Returns:
335
+ UsageFeaturePatchBuilder: The instance of the builder.
336
+ """
337
+ self._add_patch(
338
+ UsageFeaturesClass.ASPECT_NAME,
339
+ "add",
340
+ path="/rowCountPercentile",
341
+ value=percentile,
342
+ )
343
+ return self
344
+
345
+ def setUsageSearchScoreMultiplier(
346
+ self, multiplier: Optional[float]
347
+ ) -> "UsageFeaturePatchBuilder":
348
+ """Sets the usage search score multiplier.
349
+
350
+ Args:
351
+ multiplier: The usage search score multiplier.
352
+
353
+ Returns:
354
+ UsageFeaturePatchBuilder: The instance of the builder.
355
+ """
356
+ self._add_patch(
357
+ UsageFeaturesClass.ASPECT_NAME,
358
+ "add",
359
+ path="/usageSearchScoreMultiplier",
360
+ value=multiplier,
361
+ )
362
+ return self
363
+
364
+ def setUsageFreshnessScoreMultiplier(
365
+ self, multiplier: Optional[float]
366
+ ) -> "UsageFeaturePatchBuilder":
367
+ """Sets the usage freshness score multiplier.
368
+
369
+ Args:
370
+ multiplier: The usage freshness score multiplier.
371
+
372
+ Returns:
373
+ UsageFeaturePatchBuilder: The instance of the builder.
374
+ """
375
+ self._add_patch(
376
+ UsageFeaturesClass.ASPECT_NAME,
377
+ "add",
378
+ path="/usageFreshnessScoreMultiplier",
379
+ value=multiplier,
380
+ )
381
+ return self
382
+
383
+ def setCustomDatahubScoreMultiplier(
384
+ self, multiplier: Optional[float]
385
+ ) -> "UsageFeaturePatchBuilder":
386
+ """Sets the custom DataHub score multiplier.
387
+
388
+ Args:
389
+ multiplier: The custom DataHub score multiplier.
390
+
391
+ Returns:
392
+ UsageFeaturePatchBuilder: The instance of the builder.
393
+ """
394
+ self._add_patch(
395
+ UsageFeaturesClass.ASPECT_NAME,
396
+ "add",
397
+ path="/customDatahubScoreMultiplier",
398
+ value=multiplier,
399
+ )
400
+ return self
401
+
402
+ def setCombinedSearchRankingMultiplier(
403
+ self, multiplier: Optional[float]
404
+ ) -> "UsageFeaturePatchBuilder":
405
+ """Sets the combined search ranking multiplier.
406
+
407
+ Args:
408
+ multiplier: The combined search ranking multiplier.
409
+
410
+ Returns:
411
+ UsageFeaturePatchBuilder: The instance of the builder.
412
+ """
413
+ self._add_patch(
414
+ UsageFeaturesClass.ASPECT_NAME,
415
+ "add",
416
+ path="/combinedSearchRankingMultiplier",
417
+ value=multiplier,
418
+ )
419
+ return self
420
+
421
+ def apply_usage_features(
422
+ self, usage_features: UsageFeaturesClass
423
+ ) -> "UsageFeaturePatchBuilder":
424
+ """
425
+ Applies the usage features to the patch builder.
426
+ :param usage_features: UsageFeaturesClass object containing the features to apply
427
+ :return: self (UsageFeaturePatchBuilder instance)
428
+ """
429
+ feature_setters: Dict[
430
+ str,
431
+ Union[
432
+ Callable[[Optional[int]], UsageFeaturePatchBuilder],
433
+ Callable[[Optional[float]], UsageFeaturePatchBuilder],
434
+ Callable[[Optional[List[str]]], UsageFeaturePatchBuilder],
435
+ ],
436
+ ] = {
437
+ "queryCountLast30Days": self.setQueryCountLast30Days,
438
+ "viewCountLast30Days": self.setViewCountLast30Days,
439
+ "viewCountTotal": self.setViewCountTotal,
440
+ "viewCountPercentileLast30Days": self.setViewCountPercentileLast30Days,
441
+ "usageCountLast30Days": self.setUsageCountLast30Days,
442
+ "uniqueUserCountLast30Days": self.setUniqueUserCountLast30Days,
443
+ "writeCountLast30Days": self.setWriteCountLast30Days,
444
+ "queryCountPercentileLast30Days": self.setQueryCountPercentileLast30Days,
445
+ "queryCountRankLast30Days": self.setQueryCountRankLast30Days,
446
+ "uniqueUserPercentileLast30Days": self.setUniqueUserPercentileLast30Days,
447
+ "uniqueUserRankLast30Days": self.setUniqueUserRankLast30Days,
448
+ "writeCountPercentileLast30Days": self.setWriteCountPercentileLast30Days,
449
+ "writeCountRankLast30Days": self.setWriteCountRankLast30Days,
450
+ "topUsersLast30Days": self.setTopUsersLast30Days,
451
+ "sizeInBytesPercentile": self.setSizeInBytesPercentile,
452
+ "sizeInBytesRank": self.setSizeInBytesRank,
453
+ "rowCountPercentile": self.setRowCountPercentile,
454
+ "usageSearchScoreMultiplier": self.setUsageSearchScoreMultiplier,
455
+ "usageFreshnessScoreMultiplier": self.setUsageFreshnessScoreMultiplier,
456
+ "customDatahubScoreMultiplier": self.setCustomDatahubScoreMultiplier,
457
+ "combinedSearchRankingMultiplier": self.setCombinedSearchRankingMultiplier,
458
+ }
459
+
460
+ for feature, setter in feature_setters.items():
461
+ value = getattr(usage_features, feature)
462
+ if value is not None:
463
+ assert value is not None
464
+ setter(value)
465
+
466
+ return self