Warning
|
This repository is achieved as of January 2024. We are very grateful towards https://www.datageekery.com and Lukas Eder for getting this up and running! The content of this experimental work now lives on as part of the official Neo4j JDBC Driver, see the translator module. |
This library is an experiment for converting SQL statements (first only read statements) to the appropriate Cypher equivalent.
It is currently in a pre-alpha stage.
For example:
SELECT t.a, t.b
FROM my_table AS t
WHERE t.a = 1
can be translated into
MATCH (T:`MY_TABLE`)
WHERE T.A = 1
RETURN T.A, T.B
More examples can be found in the TCK.
Please go to the early access download where we offer a bunch of binaries for various operating systems and architectures. These binaries come with a dedicated and prepackaged JVM, no need to install Java separately.
Here’s an example for macOS on Apple silicon, please adapt as necessary for your system and architecture:
curl -LO https://github.com/neo4j-contrib/sql2cypher/releases/download/early-access/sql2cypher-1.0-SNAPSHOT-osx-aarch_64.zip
mkdir -p sql2cypher
bsdtar xvf sql2cypher-1.0-SNAPSHOT-osx-aarch_64.zip --strip-components=1 -C sql2cypher
./sql2cypher/bin/sql2cypher -V
Usage: sql2cypher [-hV] [--disable-pretty-printing]
[--parse-name-case=<parseNameCase>]
[--sql-dialect=<sqlDialect>]
[--table-to-label-mapping=<String=String>]... <sql> [COMMAND]
Translates SQL statements to Cypher queries.
<sql> Any valid SQL statement that should be translated to Cypher
--parse-name-case=<parseNameCase>
How to parse names; valid values are: AS_IS, LOWER,
LOWER_IF_UNQUOTED, UPPER, UPPER_IF_UNQUOTED, DEFAULT and
the default is LOWER_IF_UNQUOTED
--table-to-label-mapping=<String=String>
A table name that should be mapped to a specific label,
repeat for multiple mappings
--sql-dialect=<sqlDialect>
The SQL dialect to use for parsing; valid values are:
DEFAULT, CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE,
MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB and the
default is DEFAULT
--disable-pretty-printing
Disables pretty printing
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
help Display help information about the specified command.
Please head over to our contributing instruction to learn about build requirements, how to build this project and additional topics like native image with GraalVM.