acryl-datahub 0.15.0rc16__py3-none-any.whl → 0.15.0rc17__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 (33) hide show
  1. {acryl_datahub-0.15.0rc16.dist-info → acryl_datahub-0.15.0rc17.dist-info}/METADATA +2512 -2512
  2. {acryl_datahub-0.15.0rc16.dist-info → acryl_datahub-0.15.0rc17.dist-info}/RECORD +33 -31
  3. datahub/__init__.py +1 -1
  4. datahub/api/entities/structuredproperties/structuredproperties.py +7 -5
  5. datahub/cli/delete_cli.py +66 -20
  6. datahub/configuration/common.py +3 -3
  7. datahub/ingestion/api/source.py +5 -1
  8. datahub/ingestion/reporting/datahub_ingestion_run_summary_provider.py +2 -2
  9. datahub/ingestion/run/pipeline.py +1 -1
  10. datahub/ingestion/run/pipeline_config.py +6 -0
  11. datahub/ingestion/source/kafka/kafka.py +18 -11
  12. datahub/ingestion/source/looker/lookml_concept_context.py +1 -2
  13. datahub/ingestion/source/looker/view_upstream.py +65 -30
  14. datahub/ingestion/source/snowflake/snowflake_query.py +6 -2
  15. datahub/ingestion/source/snowflake/snowflake_report.py +1 -0
  16. datahub/ingestion/source/snowflake/snowflake_schema.py +12 -0
  17. datahub/ingestion/source/snowflake/snowflake_schema_gen.py +17 -2
  18. datahub/ingestion/source/snowflake/snowflake_utils.py +45 -5
  19. datahub/ingestion/source/state/redundant_run_skip_handler.py +1 -1
  20. datahub/ingestion/source/tableau/tableau.py +35 -16
  21. datahub/ingestion/source/tableau/tableau_common.py +0 -1
  22. datahub/metadata/_schema_classes.py +122 -2
  23. datahub/metadata/com/linkedin/pegasus2avro/structured/__init__.py +2 -0
  24. datahub/metadata/schema.avsc +73 -1
  25. datahub/metadata/schemas/StructuredPropertyDefinition.avsc +1 -1
  26. datahub/metadata/schemas/StructuredPropertyKey.avsc +1 -0
  27. datahub/metadata/schemas/StructuredPropertySettings.avsc +114 -0
  28. datahub/sql_parsing/schema_resolver.py +23 -0
  29. datahub/sql_parsing/sqlglot_lineage.py +48 -13
  30. datahub/testing/doctest.py +12 -0
  31. {acryl_datahub-0.15.0rc16.dist-info → acryl_datahub-0.15.0rc17.dist-info}/WHEEL +0 -0
  32. {acryl_datahub-0.15.0rc16.dist-info → acryl_datahub-0.15.0rc17.dist-info}/entry_points.txt +0 -0
  33. {acryl_datahub-0.15.0rc16.dist-info → acryl_datahub-0.15.0rc17.dist-info}/top_level.txt +0 -0
@@ -2995,6 +2995,7 @@
2995
2995
  "entityCategory": "core",
2996
2996
  "entityAspects": [
2997
2997
  "propertyDefinition",
2998
+ "structuredPropertySettings",
2998
2999
  "institutionalMemory",
2999
3000
  "status"
3000
3001
  ],
@@ -3328,10 +3329,81 @@
3328
3329
  ],
3329
3330
  "name": "lastModified",
3330
3331
  "default": null,
3331
- "doc": "Created Audit stamp"
3332
+ "doc": "Last Modified Audit stamp"
3332
3333
  }
3333
3334
  ]
3334
3335
  },
3336
+ {
3337
+ "type": "record",
3338
+ "Aspect": {
3339
+ "name": "structuredPropertySettings"
3340
+ },
3341
+ "name": "StructuredPropertySettings",
3342
+ "namespace": "com.linkedin.pegasus2avro.structured",
3343
+ "fields": [
3344
+ {
3345
+ "Searchable": {
3346
+ "fieldType": "BOOLEAN"
3347
+ },
3348
+ "type": "boolean",
3349
+ "name": "isHidden",
3350
+ "default": false,
3351
+ "doc": "Whether or not this asset should be hidden in the main application"
3352
+ },
3353
+ {
3354
+ "Searchable": {
3355
+ "fieldType": "BOOLEAN"
3356
+ },
3357
+ "type": "boolean",
3358
+ "name": "showInSearchFilters",
3359
+ "default": false,
3360
+ "doc": "Whether or not this asset should be displayed as a search filter"
3361
+ },
3362
+ {
3363
+ "Searchable": {
3364
+ "fieldType": "BOOLEAN"
3365
+ },
3366
+ "type": "boolean",
3367
+ "name": "showInAssetSummary",
3368
+ "default": false,
3369
+ "doc": "Whether or not this asset should be displayed in the asset sidebar"
3370
+ },
3371
+ {
3372
+ "Searchable": {
3373
+ "fieldType": "BOOLEAN"
3374
+ },
3375
+ "type": "boolean",
3376
+ "name": "showAsAssetBadge",
3377
+ "default": false,
3378
+ "doc": "Whether or not this asset should be displayed as an asset badge on other\nasset's headers"
3379
+ },
3380
+ {
3381
+ "Searchable": {
3382
+ "fieldType": "BOOLEAN"
3383
+ },
3384
+ "type": "boolean",
3385
+ "name": "showInColumnsTable",
3386
+ "default": false,
3387
+ "doc": "Whether or not this asset should be displayed as a column in the schema field table\nin a Dataset's \"Columns\" tab."
3388
+ },
3389
+ {
3390
+ "Searchable": {
3391
+ "/time": {
3392
+ "fieldName": "lastModifiedSettings",
3393
+ "fieldType": "DATETIME"
3394
+ }
3395
+ },
3396
+ "type": [
3397
+ "null",
3398
+ "com.linkedin.pegasus2avro.common.AuditStamp"
3399
+ ],
3400
+ "name": "lastModified",
3401
+ "default": null,
3402
+ "doc": "Last Modified Audit stamp"
3403
+ }
3404
+ ],
3405
+ "doc": "Settings specific to a structured property entity"
3406
+ },
3335
3407
  {
3336
3408
  "type": "record",
3337
3409
  "Aspect": {
@@ -359,7 +359,7 @@
359
359
  ],
360
360
  "name": "lastModified",
361
361
  "default": null,
362
- "doc": "Created Audit stamp"
362
+ "doc": "Last Modified Audit stamp"
363
363
  }
364
364
  ]
365
365
  }
@@ -6,6 +6,7 @@
6
6
  "entityCategory": "core",
7
7
  "entityAspects": [
8
8
  "propertyDefinition",
9
+ "structuredPropertySettings",
9
10
  "institutionalMemory",
10
11
  "status"
11
12
  ],
@@ -0,0 +1,114 @@
1
+ {
2
+ "type": "record",
3
+ "Aspect": {
4
+ "name": "structuredPropertySettings"
5
+ },
6
+ "name": "StructuredPropertySettings",
7
+ "namespace": "com.linkedin.pegasus2avro.structured",
8
+ "fields": [
9
+ {
10
+ "Searchable": {
11
+ "fieldType": "BOOLEAN"
12
+ },
13
+ "type": "boolean",
14
+ "name": "isHidden",
15
+ "default": false,
16
+ "doc": "Whether or not this asset should be hidden in the main application"
17
+ },
18
+ {
19
+ "Searchable": {
20
+ "fieldType": "BOOLEAN"
21
+ },
22
+ "type": "boolean",
23
+ "name": "showInSearchFilters",
24
+ "default": false,
25
+ "doc": "Whether or not this asset should be displayed as a search filter"
26
+ },
27
+ {
28
+ "Searchable": {
29
+ "fieldType": "BOOLEAN"
30
+ },
31
+ "type": "boolean",
32
+ "name": "showInAssetSummary",
33
+ "default": false,
34
+ "doc": "Whether or not this asset should be displayed in the asset sidebar"
35
+ },
36
+ {
37
+ "Searchable": {
38
+ "fieldType": "BOOLEAN"
39
+ },
40
+ "type": "boolean",
41
+ "name": "showAsAssetBadge",
42
+ "default": false,
43
+ "doc": "Whether or not this asset should be displayed as an asset badge on other\nasset's headers"
44
+ },
45
+ {
46
+ "Searchable": {
47
+ "fieldType": "BOOLEAN"
48
+ },
49
+ "type": "boolean",
50
+ "name": "showInColumnsTable",
51
+ "default": false,
52
+ "doc": "Whether or not this asset should be displayed as a column in the schema field table\nin a Dataset's \"Columns\" tab."
53
+ },
54
+ {
55
+ "Searchable": {
56
+ "/time": {
57
+ "fieldName": "lastModifiedSettings",
58
+ "fieldType": "DATETIME"
59
+ }
60
+ },
61
+ "type": [
62
+ "null",
63
+ {
64
+ "type": "record",
65
+ "name": "AuditStamp",
66
+ "namespace": "com.linkedin.pegasus2avro.common",
67
+ "fields": [
68
+ {
69
+ "type": "long",
70
+ "name": "time",
71
+ "doc": "When did the resource/association/sub-resource move into the specific lifecycle stage represented by this AuditEvent."
72
+ },
73
+ {
74
+ "java": {
75
+ "class": "com.linkedin.pegasus2avro.common.urn.Urn"
76
+ },
77
+ "type": "string",
78
+ "name": "actor",
79
+ "doc": "The entity (e.g. a member URN) which will be credited for moving the resource/association/sub-resource into the specific lifecycle stage. It is also the one used to authorize the change.",
80
+ "Urn": "Urn"
81
+ },
82
+ {
83
+ "java": {
84
+ "class": "com.linkedin.pegasus2avro.common.urn.Urn"
85
+ },
86
+ "type": [
87
+ "null",
88
+ "string"
89
+ ],
90
+ "name": "impersonator",
91
+ "default": null,
92
+ "doc": "The entity (e.g. a service URN) which performs the change on behalf of the Actor and must be authorized to act as the Actor.",
93
+ "Urn": "Urn"
94
+ },
95
+ {
96
+ "type": [
97
+ "null",
98
+ "string"
99
+ ],
100
+ "name": "message",
101
+ "default": null,
102
+ "doc": "Additional context around how DataHub was informed of the particular change. For example: was the change created by an automated process, or manually."
103
+ }
104
+ ],
105
+ "doc": "Data captured on a resource/association/sub-resource level giving insight into when that resource/association/sub-resource moved into a particular lifecycle stage, and who acted to move it into that specific lifecycle stage."
106
+ }
107
+ ],
108
+ "name": "lastModified",
109
+ "default": null,
110
+ "doc": "Last Modified Audit stamp"
111
+ }
112
+ ],
113
+ "doc": "Settings specific to a structured property entity"
114
+ }
@@ -123,6 +123,13 @@ class SchemaResolver(Closeable, SchemaResolverInterface):
123
123
  )
124
124
  return urn
125
125
 
126
+ def resolve_urn(self, urn: str) -> Tuple[str, Optional[SchemaInfo]]:
127
+ schema_info = self._resolve_schema_info(urn)
128
+ if schema_info:
129
+ return urn, schema_info
130
+
131
+ return urn, None
132
+
126
133
  def resolve_table(self, table: _TableName) -> Tuple[str, Optional[SchemaInfo]]:
127
134
  urn = self.get_urn_for_table(table)
128
135
 
@@ -293,3 +300,19 @@ def _convert_schema_field_list_to_info(
293
300
 
294
301
  def _convert_schema_aspect_to_info(schema_metadata: SchemaMetadataClass) -> SchemaInfo:
295
302
  return _convert_schema_field_list_to_info(schema_metadata.fields)
303
+
304
+
305
+ def match_columns_to_schema(
306
+ schema_info: SchemaInfo, input_columns: List[str]
307
+ ) -> List[str]:
308
+ column_from_gms: List[str] = list(schema_info.keys()) # list() to silent lint
309
+
310
+ gms_column_map: Dict[str, str] = {
311
+ column.lower(): column for column in column_from_gms
312
+ }
313
+
314
+ output_columns: List[str] = [
315
+ gms_column_map.get(column.lower(), column) for column in input_columns
316
+ ]
317
+
318
+ return output_columns
@@ -1181,6 +1181,45 @@ def sqlglot_lineage(
1181
1181
  )
1182
1182
 
1183
1183
 
1184
+ @functools.lru_cache(maxsize=128)
1185
+ def create_and_cache_schema_resolver(
1186
+ platform: str,
1187
+ env: str,
1188
+ graph: Optional[DataHubGraph] = None,
1189
+ platform_instance: Optional[str] = None,
1190
+ schema_aware: bool = True,
1191
+ ) -> SchemaResolver:
1192
+ return create_schema_resolver(
1193
+ platform=platform,
1194
+ env=env,
1195
+ graph=graph,
1196
+ platform_instance=platform_instance,
1197
+ schema_aware=schema_aware,
1198
+ )
1199
+
1200
+
1201
+ def create_schema_resolver(
1202
+ platform: str,
1203
+ env: str,
1204
+ graph: Optional[DataHubGraph] = None,
1205
+ platform_instance: Optional[str] = None,
1206
+ schema_aware: bool = True,
1207
+ ) -> SchemaResolver:
1208
+ if graph and schema_aware:
1209
+ return graph._make_schema_resolver(
1210
+ platform=platform,
1211
+ platform_instance=platform_instance,
1212
+ env=env,
1213
+ )
1214
+
1215
+ return SchemaResolver(
1216
+ platform=platform,
1217
+ platform_instance=platform_instance,
1218
+ env=env,
1219
+ graph=None,
1220
+ )
1221
+
1222
+
1184
1223
  def create_lineage_sql_parsed_result(
1185
1224
  query: str,
1186
1225
  default_db: Optional[str],
@@ -1191,21 +1230,17 @@ def create_lineage_sql_parsed_result(
1191
1230
  graph: Optional[DataHubGraph] = None,
1192
1231
  schema_aware: bool = True,
1193
1232
  ) -> SqlParsingResult:
1233
+ schema_resolver = create_schema_resolver(
1234
+ platform=platform,
1235
+ platform_instance=platform_instance,
1236
+ env=env,
1237
+ schema_aware=schema_aware,
1238
+ graph=graph,
1239
+ )
1240
+
1241
+ needs_close: bool = True
1194
1242
  if graph and schema_aware:
1195
1243
  needs_close = False
1196
- schema_resolver = graph._make_schema_resolver(
1197
- platform=platform,
1198
- platform_instance=platform_instance,
1199
- env=env,
1200
- )
1201
- else:
1202
- needs_close = True
1203
- schema_resolver = SchemaResolver(
1204
- platform=platform,
1205
- platform_instance=platform_instance,
1206
- env=env,
1207
- graph=None,
1208
- )
1209
1244
 
1210
1245
  try:
1211
1246
  return sqlglot_lineage(
@@ -0,0 +1,12 @@
1
+ import doctest
2
+ from types import ModuleType
3
+
4
+
5
+ def assert_doctest(module: ModuleType) -> None:
6
+ result = doctest.testmod(
7
+ module,
8
+ raise_on_error=True,
9
+ verbose=True,
10
+ )
11
+ if result.attempted == 0:
12
+ raise ValueError(f"No doctests found in {module.__name__}")