acryl-datahub 1.2.0.7rc3__py3-none-any.whl → 1.2.0.8rc1__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-1.2.0.7rc3.dist-info → acryl_datahub-1.2.0.8rc1.dist-info}/METADATA +2634 -2633
- {acryl_datahub-1.2.0.7rc3.dist-info → acryl_datahub-1.2.0.8rc1.dist-info}/RECORD +43 -40
- datahub/_version.py +1 -1
- datahub/cli/delete_cli.py +1 -0
- datahub/ingestion/api/report.py +4 -0
- datahub/ingestion/autogenerated/capability_summary.json +2 -2
- datahub/ingestion/graph/client.py +8 -1
- datahub/ingestion/source/bigquery_v2/bigquery_connection.py +12 -1
- datahub/ingestion/source/datahub/config.py +4 -0
- datahub/ingestion/source/datahub/datahub_database_reader.py +6 -1
- datahub/ingestion/source/metadata/lineage.py +8 -8
- datahub/ingestion/source/qlik_sense/qlik_sense.py +1 -1
- datahub/ingestion/source/redshift/redshift.py +1 -1
- datahub/ingestion/source/sql/athena.py +95 -18
- datahub/ingestion/source/sql/athena_properties_extractor.py +43 -25
- datahub/ingestion/source/superset.py +3 -2
- datahub/ingestion/source/tableau/tableau.py +8 -5
- datahub/ingestion/source/unity/config.py +65 -11
- datahub/ingestion/source/unity/proxy.py +90 -5
- datahub/ingestion/source/unity/proxy_patch.py +321 -0
- datahub/ingestion/source/unity/source.py +12 -0
- datahub/ingestion/source/usage/usage_common.py +1 -0
- datahub/metadata/_internal_schema_classes.py +207 -12
- datahub/metadata/com/linkedin/pegasus2avro/settings/asset/__init__.py +19 -0
- datahub/metadata/com/linkedin/pegasus2avro/template/__init__.py +6 -0
- datahub/metadata/schema.avsc +160 -12
- datahub/metadata/schemas/AssetSettings.avsc +63 -0
- datahub/metadata/schemas/DataHubPageModuleProperties.avsc +9 -1
- datahub/metadata/schemas/DataHubPageTemplateProperties.avsc +77 -1
- datahub/metadata/schemas/DataProductKey.avsc +2 -1
- datahub/metadata/schemas/DomainKey.avsc +2 -1
- datahub/metadata/schemas/GlossaryNodeKey.avsc +2 -1
- datahub/metadata/schemas/GlossaryTermKey.avsc +2 -1
- datahub/metadata/schemas/IncidentInfo.avsc +3 -3
- datahub/metadata/schemas/StructuredPropertyDefinition.avsc +0 -3
- datahub/sdk/chart.py +36 -22
- datahub/sdk/dashboard.py +38 -62
- datahub/sql_parsing/sqlglot_lineage.py +121 -28
- datahub/sql_parsing/sqlglot_utils.py +12 -1
- {acryl_datahub-1.2.0.7rc3.dist-info → acryl_datahub-1.2.0.8rc1.dist-info}/WHEEL +0 -0
- {acryl_datahub-1.2.0.7rc3.dist-info → acryl_datahub-1.2.0.8rc1.dist-info}/entry_points.txt +0 -0
- {acryl_datahub-1.2.0.7rc3.dist-info → acryl_datahub-1.2.0.8rc1.dist-info}/licenses/LICENSE +0 -0
- {acryl_datahub-1.2.0.7rc3.dist-info → acryl_datahub-1.2.0.8rc1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Proxy authentication patch for databricks-sql < 3.0 compatibility.
|
|
3
|
+
|
|
4
|
+
This module provides proxy authentication fixes for databricks-sql connector < 3.0
|
|
5
|
+
to resolve "407 Proxy Authentication Required" errors that occur even when
|
|
6
|
+
proxy environment variables are correctly set.
|
|
7
|
+
|
|
8
|
+
The patch implements the same fix as Databricks PR #354:
|
|
9
|
+
https://github.com/databricks/databricks-sql-python/pull/354
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
import os
|
|
14
|
+
import urllib.parse
|
|
15
|
+
from typing import Dict, Optional
|
|
16
|
+
|
|
17
|
+
logger: logging.Logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
PROXY_VARS = ["HTTP_PROXY", "HTTPS_PROXY", "http_proxy", "https_proxy"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def mask_proxy_credentials(url: Optional[str]) -> str:
|
|
23
|
+
"""Mask credentials in proxy URL for safe logging."""
|
|
24
|
+
if not url:
|
|
25
|
+
return "None"
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
parsed = urllib.parse.urlparse(url)
|
|
29
|
+
if parsed.username:
|
|
30
|
+
# Replace credentials with masked version
|
|
31
|
+
masked_netloc = parsed.netloc
|
|
32
|
+
if parsed.username and parsed.password:
|
|
33
|
+
masked_netloc = masked_netloc.replace(
|
|
34
|
+
f"{parsed.username}:{parsed.password}@", f"{parsed.username}:***@"
|
|
35
|
+
)
|
|
36
|
+
elif parsed.username:
|
|
37
|
+
masked_netloc = masked_netloc.replace(
|
|
38
|
+
f"{parsed.username}@", f"{parsed.username}:***@"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return urllib.parse.urlunparse(
|
|
42
|
+
(
|
|
43
|
+
parsed.scheme,
|
|
44
|
+
masked_netloc,
|
|
45
|
+
parsed.path,
|
|
46
|
+
parsed.params,
|
|
47
|
+
parsed.query,
|
|
48
|
+
parsed.fragment,
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
else:
|
|
52
|
+
return url
|
|
53
|
+
except Exception:
|
|
54
|
+
return "***INVALID_URL***"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _ensure_thrift_imports():
|
|
58
|
+
"""Ensure required thrift imports are loaded before accessing thrift_http_client.
|
|
59
|
+
|
|
60
|
+
The databricks-sql thrift_http_client requires thrift.transport.THttpClient.THttpClient
|
|
61
|
+
to be accessible. This is achieved by importing the required modules in the right order.
|
|
62
|
+
"""
|
|
63
|
+
try:
|
|
64
|
+
# Import thrift submodules - this makes them accessible as attributes
|
|
65
|
+
import thrift.transport.THttpClient # noqa: F401 # Used to make thrift.transport accessible
|
|
66
|
+
|
|
67
|
+
logger.debug("Successfully imported required thrift modules")
|
|
68
|
+
except Exception as e:
|
|
69
|
+
logger.debug(f"Could not import thrift modules: {e}")
|
|
70
|
+
raise
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _log_proxy_environment():
|
|
74
|
+
"""Log detected proxy environment variables for debugging."""
|
|
75
|
+
proxy_env_vars = {}
|
|
76
|
+
for var in PROXY_VARS:
|
|
77
|
+
value = os.environ.get(var)
|
|
78
|
+
if value:
|
|
79
|
+
masked_value = mask_proxy_credentials(value)
|
|
80
|
+
proxy_env_vars[var] = masked_value
|
|
81
|
+
|
|
82
|
+
if proxy_env_vars:
|
|
83
|
+
logger.info(f"Detected proxy environment variables: {proxy_env_vars}")
|
|
84
|
+
else:
|
|
85
|
+
logger.debug("No proxy environment variables detected")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def _basic_proxy_auth_header(proxy_url: str) -> Optional[Dict[str, str]]:
|
|
89
|
+
"""Create proxy authentication header using the same method as Databricks >= 3.0.
|
|
90
|
+
|
|
91
|
+
Based on the basic_proxy_auth_header method from databricks-sql-connector >= 3.0:
|
|
92
|
+
https://github.com/databricks/databricks-sql-python/pull/354
|
|
93
|
+
"""
|
|
94
|
+
try:
|
|
95
|
+
from urllib3.util import make_headers
|
|
96
|
+
|
|
97
|
+
parsed = urllib.parse.urlparse(proxy_url)
|
|
98
|
+
if parsed.username and parsed.password:
|
|
99
|
+
# Code reused from https://github.com/databricks/databricks-sql-python/pull/354
|
|
100
|
+
# URL decode the username and password (same as Databricks method)
|
|
101
|
+
username = urllib.parse.unquote(parsed.username)
|
|
102
|
+
password = urllib.parse.unquote(parsed.password)
|
|
103
|
+
auth_string = f"{username}:{password}"
|
|
104
|
+
|
|
105
|
+
# Create proxy URL without credentials
|
|
106
|
+
proxy_host_port = f"{parsed.scheme}://{parsed.hostname}"
|
|
107
|
+
if parsed.port:
|
|
108
|
+
proxy_host_port += f":{parsed.port}"
|
|
109
|
+
|
|
110
|
+
# Code reused from https://github.com/databricks/databricks-sql-python/pull/354
|
|
111
|
+
# Use make_headers like the newer Databricks version does
|
|
112
|
+
proxy_headers = make_headers(proxy_basic_auth=auth_string)
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
"proxy_url": proxy_host_port,
|
|
116
|
+
"proxy_headers": proxy_headers,
|
|
117
|
+
"auth_string": auth_string, # Keep for backward compatibility with tests
|
|
118
|
+
}
|
|
119
|
+
except Exception as e:
|
|
120
|
+
logger.debug(f"Failed to create proxy auth header from URL {proxy_url}: {e}")
|
|
121
|
+
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _handle_proxy_connection(self, original_open, pool_kwargs):
|
|
126
|
+
"""Handle proxy connection setup with authentication headers."""
|
|
127
|
+
from urllib3.poolmanager import ProxyManager
|
|
128
|
+
|
|
129
|
+
logger.info(f"Using proxy for connection to {self.host}:{self.port}")
|
|
130
|
+
proxy_uri = getattr(self, "proxy_uri", None)
|
|
131
|
+
logger.debug(
|
|
132
|
+
f"Proxy URI: {mask_proxy_credentials(proxy_uri) if proxy_uri else 'None'}"
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Compute proxy authentication headers properly (the bug fix!)
|
|
136
|
+
proxy_headers = None
|
|
137
|
+
proxy_env_found = None
|
|
138
|
+
for env_var in ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"]:
|
|
139
|
+
proxy_url = os.environ.get(env_var)
|
|
140
|
+
if proxy_url:
|
|
141
|
+
logger.debug(
|
|
142
|
+
f"Found proxy URL in {env_var}: {mask_proxy_credentials(proxy_url)}"
|
|
143
|
+
)
|
|
144
|
+
auth_info = _basic_proxy_auth_header(proxy_url)
|
|
145
|
+
if auth_info:
|
|
146
|
+
proxy_headers = auth_info["proxy_headers"]
|
|
147
|
+
proxy_env_found = env_var
|
|
148
|
+
logger.debug(f"Successfully created proxy headers from {env_var}")
|
|
149
|
+
break
|
|
150
|
+
else:
|
|
151
|
+
logger.debug(
|
|
152
|
+
f"No authentication info found in proxy URL from {env_var}"
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
if proxy_headers:
|
|
156
|
+
logger.info(f"Using proxy authentication headers from {proxy_env_found}")
|
|
157
|
+
else:
|
|
158
|
+
logger.warning(
|
|
159
|
+
"No proxy authentication headers could be created from environment variables"
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
proxy_manager = ProxyManager(
|
|
163
|
+
self.proxy_uri,
|
|
164
|
+
num_pools=1,
|
|
165
|
+
proxy_headers=proxy_headers,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
# Validate proxy manager attributes
|
|
169
|
+
if not hasattr(self, "realhost") or not hasattr(self, "realport"):
|
|
170
|
+
logger.warning(
|
|
171
|
+
"THttpClient missing realhost/realport attributes, falling back to original"
|
|
172
|
+
)
|
|
173
|
+
return original_open(self)
|
|
174
|
+
|
|
175
|
+
# Set up the connection pool
|
|
176
|
+
self._THttpClient__pool = proxy_manager.connection_from_host(
|
|
177
|
+
host=self.realhost,
|
|
178
|
+
port=self.realport,
|
|
179
|
+
scheme=self.scheme,
|
|
180
|
+
pool_kwargs=pool_kwargs, # type: ignore
|
|
181
|
+
)
|
|
182
|
+
logger.debug(f"Created proxy connection pool for {self.realhost}:{self.realport}")
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def _create_patched_open_method(original_open):
|
|
186
|
+
"""Create the patched THttpClient.open method with proxy authentication fix."""
|
|
187
|
+
|
|
188
|
+
def patched_open(self):
|
|
189
|
+
"""Patched version of THttpClient.open following databricks-sql >= 3.0 structure.
|
|
190
|
+
|
|
191
|
+
This is largely copied from the >= 3.0 implementation:
|
|
192
|
+
https://github.com/databricks/databricks-sql-python/pull/354/files
|
|
193
|
+
"""
|
|
194
|
+
logger.debug(
|
|
195
|
+
f"Patched THttpClient.open called for host={getattr(self, 'host', 'unknown')}, scheme={getattr(self, 'scheme', 'unknown')}"
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
try:
|
|
199
|
+
# Validate required attributes
|
|
200
|
+
required_attrs = ["scheme", "host", "port", "max_connections"]
|
|
201
|
+
missing_attrs = [attr for attr in required_attrs if not hasattr(self, attr)]
|
|
202
|
+
if missing_attrs:
|
|
203
|
+
logger.warning(
|
|
204
|
+
f"THttpClient missing required attributes: {missing_attrs}, falling back to original"
|
|
205
|
+
)
|
|
206
|
+
return original_open(self)
|
|
207
|
+
|
|
208
|
+
# Code structure reused from https://github.com/databricks/databricks-sql-python/pull/354
|
|
209
|
+
# Determine pool class based on scheme
|
|
210
|
+
if self.scheme == "http":
|
|
211
|
+
from urllib3 import HTTPConnectionPool
|
|
212
|
+
|
|
213
|
+
pool_class = HTTPConnectionPool
|
|
214
|
+
elif self.scheme == "https":
|
|
215
|
+
from urllib3 import HTTPSConnectionPool
|
|
216
|
+
|
|
217
|
+
pool_class = HTTPSConnectionPool
|
|
218
|
+
else:
|
|
219
|
+
logger.warning(
|
|
220
|
+
f"Unknown scheme '{self.scheme}', falling back to original"
|
|
221
|
+
)
|
|
222
|
+
return original_open(self)
|
|
223
|
+
|
|
224
|
+
_pool_kwargs = {"maxsize": self.max_connections}
|
|
225
|
+
logger.debug(f"Pool kwargs: {_pool_kwargs}")
|
|
226
|
+
|
|
227
|
+
if self.using_proxy():
|
|
228
|
+
return _handle_proxy_connection(self, original_open, _pool_kwargs)
|
|
229
|
+
else:
|
|
230
|
+
logger.debug(f"Direct connection (no proxy) to {self.host}:{self.port}")
|
|
231
|
+
self._THttpClient__pool = pool_class(
|
|
232
|
+
self.host, self.port, **_pool_kwargs
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
logger.debug("Patched THttpClient.open completed successfully")
|
|
236
|
+
|
|
237
|
+
except Exception as e:
|
|
238
|
+
logger.warning(
|
|
239
|
+
f"Error in proxy auth patch: {e}, falling back to original",
|
|
240
|
+
exc_info=True,
|
|
241
|
+
)
|
|
242
|
+
# Fallback to original implementation
|
|
243
|
+
try:
|
|
244
|
+
return original_open(self)
|
|
245
|
+
except Exception as fallback_error:
|
|
246
|
+
logger.error(
|
|
247
|
+
f"Fallback to original THttpClient.open also failed: {fallback_error}",
|
|
248
|
+
exc_info=True,
|
|
249
|
+
)
|
|
250
|
+
raise
|
|
251
|
+
|
|
252
|
+
return patched_open
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def apply_databricks_proxy_fix():
|
|
256
|
+
"""Apply the databricks-sql < 3.0 proxy authentication fix at module import time.
|
|
257
|
+
|
|
258
|
+
This implements the same fix as Databricks PR #354 to resolve
|
|
259
|
+
"407 Proxy Authentication Required" errors that occur even when
|
|
260
|
+
all proxy environment variables are correctly set.
|
|
261
|
+
|
|
262
|
+
Note: This fix may not work with all thrift versions due to compatibility issues
|
|
263
|
+
between databricks-sql-connector 2.9.6 and newer thrift versions. The fix will
|
|
264
|
+
gracefully fail with a warning if thrift compatibility issues are detected.
|
|
265
|
+
The main SQL functionality will continue to work normally without this fix.
|
|
266
|
+
"""
|
|
267
|
+
_log_proxy_environment()
|
|
268
|
+
logger.info("Applying databricks-sql proxy authentication fix...")
|
|
269
|
+
|
|
270
|
+
try:
|
|
271
|
+
_ensure_thrift_imports()
|
|
272
|
+
import databricks.sql.auth.thrift_http_client as thrift_http
|
|
273
|
+
|
|
274
|
+
# Store original method for fallback
|
|
275
|
+
original_open = getattr(thrift_http.THttpClient, "open", None)
|
|
276
|
+
if not original_open:
|
|
277
|
+
logger.warning("Could not find THttpClient.open method to patch")
|
|
278
|
+
return False
|
|
279
|
+
|
|
280
|
+
logger.debug(f"Found THttpClient.open method at {original_open}")
|
|
281
|
+
|
|
282
|
+
# Apply the patch
|
|
283
|
+
patched_open = _create_patched_open_method(original_open)
|
|
284
|
+
thrift_http.THttpClient.open = patched_open
|
|
285
|
+
logger.info("Successfully applied databricks-sql proxy authentication fix")
|
|
286
|
+
|
|
287
|
+
# Verify the patch was applied
|
|
288
|
+
current_method = getattr(thrift_http.THttpClient, "open", None)
|
|
289
|
+
if current_method == patched_open:
|
|
290
|
+
logger.debug(
|
|
291
|
+
"Patch verification successful: THttpClient.open is now the patched version"
|
|
292
|
+
)
|
|
293
|
+
return True
|
|
294
|
+
else:
|
|
295
|
+
logger.warning(
|
|
296
|
+
"Patch verification failed: THttpClient.open was not replaced correctly"
|
|
297
|
+
)
|
|
298
|
+
return False
|
|
299
|
+
|
|
300
|
+
except ImportError as e:
|
|
301
|
+
logger.debug(f"Could not import databricks-sql internals for proxy patch: {e}")
|
|
302
|
+
return False
|
|
303
|
+
except AttributeError as e:
|
|
304
|
+
if "thrift" in str(e).lower() and "transport" in str(e).lower():
|
|
305
|
+
warning_msg = (
|
|
306
|
+
f"Databricks-sql proxy authentication patch could not be applied due to thrift version incompatibility: {e}. "
|
|
307
|
+
"In most environments, the SQL connection will still work without this patch."
|
|
308
|
+
)
|
|
309
|
+
logger.warning(warning_msg)
|
|
310
|
+
# Import here to avoid circular imports
|
|
311
|
+
from datahub.utilities.global_warning_util import add_global_warning
|
|
312
|
+
|
|
313
|
+
add_global_warning(warning_msg)
|
|
314
|
+
else:
|
|
315
|
+
logger.error(
|
|
316
|
+
f"Failed to apply databricks-sql proxy patch: {e}", exc_info=True
|
|
317
|
+
)
|
|
318
|
+
return False
|
|
319
|
+
except Exception as e:
|
|
320
|
+
logger.error(f"Failed to apply databricks-sql proxy patch: {e}", exc_info=True)
|
|
321
|
+
return False
|
|
@@ -257,6 +257,18 @@ class UnityCatalogSource(StatefulIngestionSourceBase, TestableSource):
|
|
|
257
257
|
else:
|
|
258
258
|
self.platform_resource_repository = None
|
|
259
259
|
|
|
260
|
+
if self.config._forced_disable_tag_extraction:
|
|
261
|
+
self.report.report_warning(
|
|
262
|
+
"Some features disabled because of configuration conflicts",
|
|
263
|
+
"Tag Extraction is disabled due to missing warehouse_id in config",
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
if self.config._forced_disable_hive_metastore_extraction:
|
|
267
|
+
self.report.report_warning(
|
|
268
|
+
"Some features disabled because of configuration conflicts",
|
|
269
|
+
"Hive Metastore Extraction is disabled due to missing warehouse_id in config",
|
|
270
|
+
)
|
|
271
|
+
|
|
260
272
|
# Include platform resource repository in report for automatic cache statistics
|
|
261
273
|
if self.config.include_tags and self.platform_resource_repository:
|
|
262
274
|
self.report.tag_urn_resolver_cache = self.platform_resource_repository
|