databricks-switch-plugin 1.0.0__tar.gz

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 (67) hide show
  1. databricks_switch_plugin-1.0.0/.gitignore +173 -0
  2. databricks_switch_plugin-1.0.0/LICENSE +69 -0
  3. databricks_switch_plugin-1.0.0/NOTICE +6 -0
  4. databricks_switch_plugin-1.0.0/PKG-INFO +117 -0
  5. databricks_switch_plugin-1.0.0/README.md +62 -0
  6. databricks_switch_plugin-1.0.0/lsp/config.yml +99 -0
  7. databricks_switch_plugin-1.0.0/pyproject.toml +328 -0
  8. databricks_switch_plugin-1.0.0/switch/__init__.py +0 -0
  9. databricks_switch_plugin-1.0.0/switch/api/__init__.py +5 -0
  10. databricks_switch_plugin-1.0.0/switch/api/installer.py +356 -0
  11. databricks_switch_plugin-1.0.0/switch/api/job_parameters.py +258 -0
  12. databricks_switch_plugin-1.0.0/switch/api/job_runner.py +104 -0
  13. databricks_switch_plugin-1.0.0/switch/notebooks/00_main.py +211 -0
  14. databricks_switch_plugin-1.0.0/switch/notebooks/__init__.py +0 -0
  15. databricks_switch_plugin-1.0.0/switch/notebooks/exporters/__init__.py +1 -0
  16. databricks_switch_plugin-1.0.0/switch/notebooks/exporters/convert_notebook_to_sql.py +532 -0
  17. databricks_switch_plugin-1.0.0/switch/notebooks/exporters/export_to_file.py +208 -0
  18. databricks_switch_plugin-1.0.0/switch/notebooks/exporters/export_to_notebook.py +152 -0
  19. databricks_switch_plugin-1.0.0/switch/notebooks/external_model/external_model_amazon_bedrock.py +95 -0
  20. databricks_switch_plugin-1.0.0/switch/notebooks/external_model/external_model_azure_openai.py +99 -0
  21. databricks_switch_plugin-1.0.0/switch/notebooks/external_model/helper_external_model.py +97 -0
  22. databricks_switch_plugin-1.0.0/switch/notebooks/notebook_utils.py +474 -0
  23. databricks_switch_plugin-1.0.0/switch/notebooks/orchestrators/__init__.py +1 -0
  24. databricks_switch_plugin-1.0.0/switch/notebooks/orchestrators/orchestrate_to_file.py +164 -0
  25. databricks_switch_plugin-1.0.0/switch/notebooks/orchestrators/orchestrate_to_notebook.py +304 -0
  26. databricks_switch_plugin-1.0.0/switch/notebooks/processors/__init__.py +1 -0
  27. databricks_switch_plugin-1.0.0/switch/notebooks/processors/analyze_input_files.py +255 -0
  28. databricks_switch_plugin-1.0.0/switch/notebooks/processors/convert_with_llm.py +244 -0
  29. databricks_switch_plugin-1.0.0/switch/notebooks/processors/fix_syntax_with_llm.py +258 -0
  30. databricks_switch_plugin-1.0.0/switch/notebooks/processors/split_code_into_cells.py +108 -0
  31. databricks_switch_plugin-1.0.0/switch/notebooks/processors/validate_python_notebook.py +165 -0
  32. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/__init__.py +0 -0
  33. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/helpers/__init__.py +0 -0
  34. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/helpers/batch_inference_helper.py +718 -0
  35. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/helpers/cell_split_helper.py +312 -0
  36. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/helpers/conversion_prompt_helper.py +161 -0
  37. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/helpers/conversion_result_clean_helper.py +54 -0
  38. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/helpers/llm_token_count_helper.py +117 -0
  39. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/helpers/notebook_export_helper.py +188 -0
  40. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/helpers/spark_sql_extract_helper.py +168 -0
  41. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/types/__init__.py +16 -0
  42. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/types/builtin_prompt.py +93 -0
  43. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/types/comment_language.py +273 -0
  44. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/types/log_level.py +23 -0
  45. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/types/source_format.py +22 -0
  46. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/types/table_config.py +10 -0
  47. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/types/target_type.py +21 -0
  48. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/utils/__init__.py +0 -0
  49. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/utils/common_utils.py +159 -0
  50. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/utils/databricks_credentials.py +78 -0
  51. databricks_switch_plugin-1.0.0/switch/notebooks/pyscripts/utils/token_utils.py +128 -0
  52. databricks_switch_plugin-1.0.0/switch/resources/__init__.py +0 -0
  53. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/code_to_databricks_python_notebook/python.yml +66 -0
  54. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/code_to_databricks_python_notebook/scala.yml +79 -0
  55. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/common/sql_to_databricks_notebook_common_python.yml +95 -0
  56. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/databricks_notebook_to_databricks_notebook/python_to_sql.yml +111 -0
  57. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/sql_to_databricks_python_notebook/mysql.yml +240 -0
  58. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/sql_to_databricks_python_notebook/netezza.yml +239 -0
  59. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/sql_to_databricks_python_notebook/oracle.yml +238 -0
  60. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/sql_to_databricks_python_notebook/postgresql.yml +233 -0
  61. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/sql_to_databricks_python_notebook/redshift.yml +233 -0
  62. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/sql_to_databricks_python_notebook/snowflake.yml +257 -0
  63. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/sql_to_databricks_python_notebook/teradata.yml +224 -0
  64. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/sql_to_databricks_python_notebook/tsql.yml +251 -0
  65. databricks_switch_plugin-1.0.0/switch/resources/builtin_prompts/workflow_to_databricks_jobs/airflow.yml +75 -0
  66. databricks_switch_plugin-1.0.0/switch/testing/__init__.py +5 -0
  67. databricks_switch_plugin-1.0.0/switch/testing/e2e_utils.py +496 -0
@@ -0,0 +1,173 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
163
+
164
+ # Databricks
165
+ .databricks/
166
+
167
+ # Project specific
168
+ .clinerules/
169
+ .vscode/
170
+ scratch/**
171
+ !scratch/README.md
172
+ test_output/
173
+ databricks.yml
@@ -0,0 +1,69 @@
1
+ Databricks License
2
+ Copyright (2024) Databricks, Inc.
3
+
4
+ Definitions.
5
+
6
+ Agreement: The agreement between Databricks, Inc., and you governing
7
+ the use of the Databricks Services, as that term is defined in
8
+ the Master Cloud Services Agreement (MCSA) located at
9
+ www.databricks.com/legal/mcsa.
10
+
11
+ Licensed Materials: The source code, object code, data, and/or other
12
+ works to which this license applies.
13
+
14
+ Scope of Use. You may not use the Licensed Materials except in
15
+ connection with your use of the Databricks Services pursuant to
16
+ the Agreement. Your use of the Licensed Materials must comply at all
17
+ times with any restrictions applicable to the Databricks Services,
18
+ generally, and must be used in accordance with any applicable
19
+ documentation. You may view, use, copy, modify, publish, and/or
20
+ distribute the Licensed Materials solely for the purposes of using
21
+ the Licensed Materials within or connecting to the Databricks Services.
22
+ If you do not agree to these terms, you may not view, use, copy,
23
+ modify, publish, and/or distribute the Licensed Materials.
24
+
25
+ Redistribution. You may redistribute and sublicense the Licensed
26
+ Materials so long as all use is in compliance with these terms.
27
+ In addition:
28
+
29
+ - You must give any other recipients a copy of this License;
30
+ - You must cause any modified files to carry prominent notices
31
+ stating that you changed the files;
32
+ - You must retain, in any derivative works that you distribute,
33
+ all copyright, patent, trademark, and attribution notices,
34
+ excluding those notices that do not pertain to any part of
35
+ the derivative works; and
36
+ - If a "NOTICE" text file is provided as part of its
37
+ distribution, then any derivative works that you distribute
38
+ must include a readable copy of the attribution notices
39
+ contained within such NOTICE file, excluding those notices
40
+ that do not pertain to any part of the derivative works.
41
+
42
+ You may add your own copyright statement to your modifications and may
43
+ provide additional license terms and conditions for use, reproduction,
44
+ or distribution of your modifications, or for any such derivative works
45
+ as a whole, provided your use, reproduction, and distribution of
46
+ the Licensed Materials otherwise complies with the conditions stated
47
+ in this License.
48
+
49
+ Termination. This license terminates automatically upon your breach of
50
+ these terms or upon the termination of your Agreement. Additionally,
51
+ Databricks may terminate this license at any time on notice. Upon
52
+ termination, you must permanently delete the Licensed Materials and
53
+ all copies thereof.
54
+
55
+ DISCLAIMER; LIMITATION OF LIABILITY.
56
+
57
+ THE LICENSED MATERIALS ARE PROVIDED “AS-IS” AND WITH ALL FAULTS.
58
+ DATABRICKS, ON BEHALF OF ITSELF AND ITS LICENSORS, SPECIFICALLY
59
+ DISCLAIMS ALL WARRANTIES RELATING TO THE LICENSED MATERIALS, EXPRESS
60
+ AND IMPLIED, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES,
61
+ CONDITIONS AND OTHER TERMS OF MERCHANTABILITY, SATISFACTORY QUALITY OR
62
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. DATABRICKS AND
63
+ ITS LICENSORS TOTAL AGGREGATE LIABILITY RELATING TO OR ARISING OUT OF
64
+ YOUR USE OF OR DATABRICKS’ PROVISIONING OF THE LICENSED MATERIALS SHALL
65
+ BE LIMITED TO ONE THOUSAND ($1,000) DOLLARS. IN NO EVENT SHALL
66
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
67
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
68
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE LICENSED MATERIALS OR
69
+ THE USE OR OTHER DEALINGS IN THE LICENSED MATERIALS.
@@ -0,0 +1,6 @@
1
+ [Project Name]
2
+
3
+ Copyright (2018) Databricks, Inc.
4
+
5
+
6
+ This Software includes software developed at Databricks (https://www.databricks.com/) and its use is subject to the included LICENSE file.
@@ -0,0 +1,117 @@
1
+ Metadata-Version: 2.4
2
+ Name: databricks-switch-plugin
3
+ Version: 1.0.0
4
+ Summary: LLM-powered tool to convert SQL, code, and workflow files into Databricks notebooks.
5
+ Project-URL: Documentation, https://databrickslabs.github.io/lakebridge
6
+ Project-URL: Issues, https://github.com/databrickslabs/lakebridge/issues
7
+ Project-URL: Source, https://github.com/databrickslabs/lakebridge
8
+ Maintainer-email: Databricks Labs <labs-oss@databricks.com>
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Keywords: Conversion,Databricks,LLM,Migration,SQL
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Framework :: Pytest
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: Other/Proprietary License
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Topic :: Software Development :: Libraries
26
+ Classifier: Topic :: Utilities
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: anytree==2.13.0
29
+ Requires-Dist: chardet==5.2.0
30
+ Requires-Dist: httpx==0.28.1
31
+ Requires-Dist: omegaconf==2.3.0
32
+ Requires-Dist: pyyaml==6.0.2
33
+ Requires-Dist: tenacity==9.1.2
34
+ Requires-Dist: tiktoken==0.9.0
35
+ Provides-Extra: dev
36
+ Requires-Dist: black~=25.1.0; extra == 'dev'
37
+ Requires-Dist: coverage[toml]~=7.8.0; extra == 'dev'
38
+ Requires-Dist: databricks-connect~=17.0.1; extra == 'dev'
39
+ Requires-Dist: databricks-labs-pylint~=0.4.0; extra == 'dev'
40
+ Requires-Dist: databricks-labs-pytester>=0.3.0; extra == 'dev'
41
+ Requires-Dist: databricks-sdk~=0.51.0; extra == 'dev'
42
+ Requires-Dist: hatch; extra == 'dev'
43
+ Requires-Dist: mypy~=1.10.0; extra == 'dev'
44
+ Requires-Dist: pylint-pytest==2.0.0a0; extra == 'dev'
45
+ Requires-Dist: pylint~=3.2.2; extra == 'dev'
46
+ Requires-Dist: pytest-asyncio~=0.26.0; extra == 'dev'
47
+ Requires-Dist: pytest-cov<6.0.0,>=5.0.0; extra == 'dev'
48
+ Requires-Dist: pytest-xdist~=3.5.0; extra == 'dev'
49
+ Requires-Dist: pytest~=8.3.5; extra == 'dev'
50
+ Requires-Dist: python-dotenv>=1.0.0; extra == 'dev'
51
+ Requires-Dist: ruff~=0.11.6; extra == 'dev'
52
+ Requires-Dist: types-pytz~=2025.2; extra == 'dev'
53
+ Requires-Dist: types-pyyaml~=6.0.12; extra == 'dev'
54
+ Description-Content-Type: text/markdown
55
+
56
+ # Switch
57
+ LLM-Powered Code Conversion Plugin for Lakebridge
58
+
59
+ ## Project Description
60
+ Switch is a Lakebridge transpiler plugin that transforms SQL and other source formats into Databricks-compatible notebooks using Large Language Models (LLMs). As a core component of the Lakebridge migration platform, Switch provides automated code conversion capabilities through a multi-stage processing pipeline designed for large-scale platform migrations.
61
+
62
+ ## Project Support
63
+ Please note that all projects in the /databrickslabs github account are provided for your exploration only, and are not formally supported by Databricks with Service Level Agreements (SLAs). They are provided AS-IS and we do not make any guarantees of any kind. Please do not submit a support ticket relating to any issues arising from the use of these projects.
64
+
65
+ Any issues discovered through the use of this project should be filed as GitHub Issues on the Repo. They will be reviewed as time permits, but there are no formal SLAs for support.
66
+
67
+ ## Key Features
68
+ - **AI-Powered Conversion**: Leverages Large Language Models for intelligent code transformation
69
+ - **Multi-Format Support**: Converts various source formats including SQL, code files, and workflow definitions
70
+ - **Flexible Output**: Generates multiple output formats tailored to your migration needs
71
+ - **Built-in Templates**: Comprehensive conversion templates for common database and platform migrations
72
+ - **Cloud-Native Processing**: Scalable execution on Databricks platform infrastructure
73
+ - **Stateful Tracking**: Maintains conversion progress and results for large-scale migrations
74
+ - **Extensible Design**: Customizable template system for specialized conversion requirements
75
+
76
+ ## Using the Project
77
+
78
+ ### Primary Usage: Lakebridge Integration
79
+ Switch is primarily designed as a Lakebridge transpiler plugin. To use Switch for code conversion:
80
+
81
+ 1. **Install Lakebridge**: Follow the [Lakebridge documentation](https://databrickslabs.github.io/lakebridge)
82
+ 2. **Install Switch transpiler**: Use Lakebridge to install the Switch transpiler plugin
83
+ 3. **Run conversion**: Use Lakebridge's transpile command with Switch
84
+
85
+ For complete usage instructions and configuration options, refer to the [Lakebridge documentation](https://databrickslabs.github.io/lakebridge).
86
+
87
+ ### Alternative Usage: Direct Deployment
88
+ For advanced testing or direct control, you can deploy Switch directly to a Databricks workspace:
89
+
90
+ **Cell 1: Install Switch package**
91
+
92
+ From PyPI (stable):
93
+ ```python
94
+ %pip install databricks-switch-plugin
95
+ ```
96
+
97
+ Or from Test PyPI (development/preview versions):
98
+ ```python
99
+ %pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple databricks-switch-plugin
100
+ ```
101
+
102
+ **Cell 2: Deploy Switch to workspace**
103
+ ```python
104
+ from databricks.sdk import WorkspaceClient
105
+ from switch.api.installer import SwitchInstaller
106
+
107
+ ws = WorkspaceClient()
108
+ installer = SwitchInstaller(ws)
109
+ result = installer.install()
110
+
111
+ print(f"Switch job created: {result.job_url}")
112
+ ```
113
+
114
+ After installation, use the created job in Databricks Jobs UI to run conversions with your specific parameters.
115
+
116
+ ## For Developers
117
+ For development setup, advanced usage, testing, and technical details, see [DEVELOPER.md](./DEVELOPER.md).
@@ -0,0 +1,62 @@
1
+ # Switch
2
+ LLM-Powered Code Conversion Plugin for Lakebridge
3
+
4
+ ## Project Description
5
+ Switch is a Lakebridge transpiler plugin that transforms SQL and other source formats into Databricks-compatible notebooks using Large Language Models (LLMs). As a core component of the Lakebridge migration platform, Switch provides automated code conversion capabilities through a multi-stage processing pipeline designed for large-scale platform migrations.
6
+
7
+ ## Project Support
8
+ Please note that all projects in the /databrickslabs github account are provided for your exploration only, and are not formally supported by Databricks with Service Level Agreements (SLAs). They are provided AS-IS and we do not make any guarantees of any kind. Please do not submit a support ticket relating to any issues arising from the use of these projects.
9
+
10
+ Any issues discovered through the use of this project should be filed as GitHub Issues on the Repo. They will be reviewed as time permits, but there are no formal SLAs for support.
11
+
12
+ ## Key Features
13
+ - **AI-Powered Conversion**: Leverages Large Language Models for intelligent code transformation
14
+ - **Multi-Format Support**: Converts various source formats including SQL, code files, and workflow definitions
15
+ - **Flexible Output**: Generates multiple output formats tailored to your migration needs
16
+ - **Built-in Templates**: Comprehensive conversion templates for common database and platform migrations
17
+ - **Cloud-Native Processing**: Scalable execution on Databricks platform infrastructure
18
+ - **Stateful Tracking**: Maintains conversion progress and results for large-scale migrations
19
+ - **Extensible Design**: Customizable template system for specialized conversion requirements
20
+
21
+ ## Using the Project
22
+
23
+ ### Primary Usage: Lakebridge Integration
24
+ Switch is primarily designed as a Lakebridge transpiler plugin. To use Switch for code conversion:
25
+
26
+ 1. **Install Lakebridge**: Follow the [Lakebridge documentation](https://databrickslabs.github.io/lakebridge)
27
+ 2. **Install Switch transpiler**: Use Lakebridge to install the Switch transpiler plugin
28
+ 3. **Run conversion**: Use Lakebridge's transpile command with Switch
29
+
30
+ For complete usage instructions and configuration options, refer to the [Lakebridge documentation](https://databrickslabs.github.io/lakebridge).
31
+
32
+ ### Alternative Usage: Direct Deployment
33
+ For advanced testing or direct control, you can deploy Switch directly to a Databricks workspace:
34
+
35
+ **Cell 1: Install Switch package**
36
+
37
+ From PyPI (stable):
38
+ ```python
39
+ %pip install databricks-switch-plugin
40
+ ```
41
+
42
+ Or from Test PyPI (development/preview versions):
43
+ ```python
44
+ %pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple databricks-switch-plugin
45
+ ```
46
+
47
+ **Cell 2: Deploy Switch to workspace**
48
+ ```python
49
+ from databricks.sdk import WorkspaceClient
50
+ from switch.api.installer import SwitchInstaller
51
+
52
+ ws = WorkspaceClient()
53
+ installer = SwitchInstaller(ws)
54
+ result = installer.install()
55
+
56
+ print(f"Switch job created: {result.job_url}")
57
+ ```
58
+
59
+ After installation, use the created job in Databricks Jobs UI to run conversions with your specific parameters.
60
+
61
+ ## For Developers
62
+ For development setup, advanced usage, testing, and technical details, see [DEVELOPER.md](./DEVELOPER.md).
@@ -0,0 +1,99 @@
1
+ # Switch transpiler configuration for Lakebridge integration
2
+ # This file enables Lakebridge to discover and use Switch as a transpiler
3
+ remorph:
4
+ version: 1
5
+ name: switch
6
+ command_line: ["echo", "Switch uses Jobs API, not LSP"]
7
+ dialects:
8
+ # SQL dialects
9
+ - mysql
10
+ - netezza
11
+ - oracle
12
+ - postgresql
13
+ - redshift
14
+ - snowflake
15
+ - teradata
16
+ - tsql
17
+
18
+ # Generic conversions
19
+ - python
20
+ - scala
21
+ - airflow
22
+
23
+ options:
24
+ all:
25
+ # Conversion settings
26
+ - flag: source_format
27
+ method: CHOICE
28
+ prompt: "Source file format"
29
+ choices: ["sql", "generic"]
30
+ default: "sql"
31
+ - flag: target_type
32
+ method: CHOICE
33
+ prompt: "Target output type"
34
+ choices: ["notebook", "file"]
35
+ default: "notebook"
36
+ - flag: output_extension
37
+ method: QUESTION
38
+ prompt: "Output file extension (for file target type) - press <enter> for none"
39
+ default: "<none>"
40
+
41
+ # Execution settings
42
+ - flag: endpoint_name
43
+ method: QUESTION
44
+ prompt: "Model endpoint name"
45
+ default: "databricks-claude-sonnet-4"
46
+ - flag: concurrency
47
+ method: QUESTION
48
+ prompt: "Concurrency level"
49
+ default: 4
50
+ - flag: max_fix_attempts
51
+ method: QUESTION
52
+ prompt: "Maximum fix attempts"
53
+ default: 1
54
+ - flag: log_level
55
+ method: CHOICE
56
+ prompt: "Log level"
57
+ choices: ["DEBUG", "INFO", "WARNING", "ERROR"]
58
+ default: "INFO"
59
+
60
+ # Advanced settings
61
+ - flag: token_count_threshold
62
+ method: QUESTION
63
+ prompt: "Token count threshold"
64
+ default: 20000
65
+ - flag: comment_lang
66
+ method: CHOICE
67
+ prompt: "Comment language"
68
+ choices: ["English", "Japanese", "Chinese", "French", "German", "Italian", "Korean", "Portuguese", "Spanish"]
69
+ default: "English"
70
+ - flag: conversion_prompt_yaml
71
+ method: QUESTION
72
+ prompt: "Custom conversion prompt YAML file path - press <enter> for default"
73
+ default: "<none>"
74
+ - flag: sql_output_dir
75
+ method: QUESTION
76
+ prompt: "SQL output directory - press <enter> for none"
77
+ default: "<none>"
78
+
79
+ # Complex optional parameters
80
+ - flag: request_params
81
+ method: QUESTION
82
+ prompt: "Additional request parameters (JSON) - press <enter> for none"
83
+ default: "<none>"
84
+
85
+ # Lakebridge CLI specific settings
86
+ - flag: wait_for_completion
87
+ method: CHOICE
88
+ prompt: "Wait for job completion?"
89
+ choices: ["true", "false"]
90
+ default: "false"
91
+
92
+ # Custom configuration for Jobs API execution
93
+ custom:
94
+ execution_type: "jobs_api"
95
+ job_id: null # Populated after installation
96
+ job_name: null # Populated after installation
97
+ job_url: null # Populated after installation
98
+ switch_home: null # Populated after installation
99
+ created_by: null # Populated after installation