sqlglot-exasol
๐ Transpile any SQL dialect to Exasol SQL using a custom sqlglot dialect.
This project extends sqlglot with a custom dialect for Exasol, enabling SQL translation from dialect to Exasol syntax.
โ ๏ธ This fork includes an unpublished Exasol dialect. You must install this fork locally to use the transpiler.
โจ Features
- Convert sql dialect to Exasol-compatible syntax
- Uses the
sqlglotAST to handle dialect transformations - Easily transpile
.sqlfiles from one dialect to another
๐ง Installation
Clone this repo and install your forked version of sqlglot locally:
git clone https://github.com/gpicode/sqlglot cd sqlglot git checkout staging pip install -e .
NOTE: Ensure you check out the staging branch to use this fork.
๐ Usage
Transpile a SQL file from Sqlite to Exasol Example usage from the command line (create a script like transpile.py) or use the sample transpile.py file:
import sqlglot with open("input.sql", "r") as f: sql = f.read() # Use your custom dialect transpiled_sql = sqlglot.transpile(sql, read="databricks", write="exasol")[0] with open("output.sql", "w") as f: f.write(transpiled_sql)
๐งช Example
Using the sample transpile.py file to transpile a file from Sqlite to Exasol, run:
python transpile.py input.sql output.sql