databricks-bb-analyzer 0.1.0__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.
- databricks/__init__.py +0 -0
- databricks/labs/__init__.py +0 -0
- databricks/labs/remorph/__init__.py +0 -0
- databricks/labs/remorph/bladespector/Analyzer/Linux/analyzer +0 -0
- databricks/labs/remorph/bladespector/Analyzer/MacOS/analyzer +0 -0
- databricks/labs/remorph/bladespector/Analyzer/Windows/analyzer.exe +0 -0
- databricks/labs/remorph/bladespector/__about__.py +2 -0
- databricks/labs/remorph/bladespector/__init__.py +0 -0
- databricks/labs/remorph/bladespector/analyzer.py +72 -0
- databricks_bb_analyzer-0.1.0.dist-info/METADATA +15 -0
- databricks_bb_analyzer-0.1.0.dist-info/RECORD +12 -0
- databricks_bb_analyzer-0.1.0.dist-info/WHEEL +4 -0
databricks/__init__.py
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from copy import deepcopy
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
logger = logging.getLogger(__name__)
|
|
9
|
+
|
|
10
|
+
_PLATFORM_TO_SOURCE_TECHNOLOGY = {
|
|
11
|
+
"ADF": "ADF",
|
|
12
|
+
"Datastage": "DATASTAGE",
|
|
13
|
+
"Informatica - Big Data Edition": "INFADEV",
|
|
14
|
+
"Informatica - Desktop": "INFA",
|
|
15
|
+
"SAS": "SAS",
|
|
16
|
+
"SQL": "SQL",
|
|
17
|
+
"SSIS": "SSIS",
|
|
18
|
+
"Talend": "TALEND",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class Analyzer():
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
self._binary = self._locate_binary()
|
|
25
|
+
|
|
26
|
+
def analyze(self, directory: Path, result: Path, platform: str):
|
|
27
|
+
technology = _PLATFORM_TO_SOURCE_TECHNOLOGY.get(platform, None)
|
|
28
|
+
if not technology:
|
|
29
|
+
raise ValueError(f"Unsupported platform: {platform}")
|
|
30
|
+
self._run_binary(directory, result, technology)
|
|
31
|
+
|
|
32
|
+
def _run_binary(self, directory: Path, result: Path, technology: str):
|
|
33
|
+
try:
|
|
34
|
+
args = [
|
|
35
|
+
str(self._binary),
|
|
36
|
+
"-d",
|
|
37
|
+
f"{directory}",
|
|
38
|
+
"-r",
|
|
39
|
+
f"{result}",
|
|
40
|
+
"-t",
|
|
41
|
+
technology,
|
|
42
|
+
"-v",
|
|
43
|
+
]
|
|
44
|
+
env = deepcopy(os.environ)
|
|
45
|
+
env["UTF8_NOT_SUPPORTED"] = str(1)
|
|
46
|
+
completed = subprocess.run(args, env=env, capture_output=True, text=True)
|
|
47
|
+
if completed.stderr:
|
|
48
|
+
logger.error(f"cmd line: {' '.join(args)}")
|
|
49
|
+
if completed.stdout:
|
|
50
|
+
for line in completed.stdout.split("\n"):
|
|
51
|
+
logger.error(line) if completed.stderr else logger.info(line)
|
|
52
|
+
if completed.stderr:
|
|
53
|
+
for line in completed.stderr.split("\n"):
|
|
54
|
+
logger.error(line)
|
|
55
|
+
# manage return code
|
|
56
|
+
completed.check_returncode()
|
|
57
|
+
return None
|
|
58
|
+
# it is good practice to catch broad exceptions raised by launching a child process
|
|
59
|
+
except Exception as e: # pylint: disable=broad-exception-caught
|
|
60
|
+
logger.error("Conversion failed", exc_info=e)
|
|
61
|
+
return str(e)
|
|
62
|
+
|
|
63
|
+
def _locate_binary(self) -> Path:
|
|
64
|
+
if 'darwin' in sys.platform:
|
|
65
|
+
tool = "MacOS/analyzer"
|
|
66
|
+
elif 'win' in sys.platform:
|
|
67
|
+
tool = "Windows/analyzer.exe"
|
|
68
|
+
elif 'linux' in sys.platform:
|
|
69
|
+
tool = "Linux/analyzer"
|
|
70
|
+
else:
|
|
71
|
+
raise Exception(f"Unsupported platform: {sys.platform}")
|
|
72
|
+
return Path(__file__).parent / "Analyzer" / tool
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: databricks-bb-analyzer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Remorph analyzer
|
|
5
|
+
Project-URL: Documentation, https://github.com/databrickslabs/bladerunner
|
|
6
|
+
Project-URL: Issues, https://github.com/databrickslabs/bladerunner/issues
|
|
7
|
+
Project-URL: Source, https://github.com/databrickslabs/bladerunner
|
|
8
|
+
Keywords: Analyzer,Databricks,Remorph
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# Databricks Labs Remorph Analyzer Plugin
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
databricks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
databricks/labs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
databricks/labs/remorph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
databricks/labs/remorph/bladespector/__about__.py,sha256=t3ygaZ5BEYUORV-oYhHoRS3uOr1kZ-0l27T-2qJM0uk,48
|
|
5
|
+
databricks/labs/remorph/bladespector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
databricks/labs/remorph/bladespector/analyzer.py,sha256=zKVy_nb8bS2pXJLtDJWenHfpfHsgdu-NQJx90SALpA0,2430
|
|
7
|
+
databricks/labs/remorph/bladespector/Analyzer/Linux/analyzer,sha256=oqrPe410eEWDjEKIEWf-22NB5wgQsKwQdgU-kywO3Ek,10477733
|
|
8
|
+
databricks/labs/remorph/bladespector/Analyzer/MacOS/analyzer,sha256=I8WpimMLsJBUXvegNGgZxhSetHy_9F_S-VR6OVlrXX8,12351587
|
|
9
|
+
databricks/labs/remorph/bladespector/Analyzer/Windows/analyzer.exe,sha256=gXYQhokKiEzEtmpunbmg13DJuTMFIxsL_poz2I1M328,14611830
|
|
10
|
+
databricks_bb_analyzer-0.1.0.dist-info/METADATA,sha256=kFzQC74O0PIhnjwps4K0IYGRyE6EMzjT0zKOZDhXIWk,619
|
|
11
|
+
databricks_bb_analyzer-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
+
databricks_bb_analyzer-0.1.0.dist-info/RECORD,,
|