The current version is 1.0.0. Please see the changelog for details on version history.
Overview
This package implements a command-line tool for converting Apache Cassandra Query Language (CQL) scripts to AWS CloudFormation (CFN) templates, which allows Amazon Keyspaces (for Apache Cassandra) schema to be easily managed in AWS CloudFormation stacks.
The tool currently supports the following statements:
CREATE KEYSPACE
CREATE TABLE
USE
Example Usage
Given a CQL script named my_cql_script.cql
CREATE KEYSPACE my_keyspace WITH replication = {'class': 'SingleRegionStrategy'};
USE my_keyspace;
CREATE TABLE my_table (pk int PRIMARY KEY);
run the tool by executing
$ cql2cfn my_cql_script.cql my_cfn_template.json
this will produce a CFN template named my_cfn_template.json
The tool requires one argument, the path to the CQL script to be converted. An optional second argument can be supplied to specify the path to the generated CFN template; otherwise, the generated CFN template is printed out to the standard output.
By default, the tool operates in relaxed mode, in which case it only gives warnings about the following issues:
A property specified for a keyspace/table is not applicable to or supported by Keyspaces
A keyspace/table is created a second time without IF NOT EXISTS
A keyspace is referenced without being created before
These warnings can be turned into errors by supplying the --strict option to the tool.
A help message can be printed out by using the --help option.
How to build the tool
The tool needs to be built from source by running the following on Linux/MacOS…
./gradlew installDist
on Microsoft Windows, run…
gradlew.bat installDist
JDK 11 or later is required for building the tool.
After it is built successfully, the executable can be found in ./build/install/cql2cfn/bin/cql2cfn.
IMPORTANT: Latest Version
The current version is 1.0.0. Please see the changelog for details on version history.
Overview
This package implements a command-line tool for converting Apache Cassandra Query Language (CQL) scripts to AWS CloudFormation (CFN) templates, which allows Amazon Keyspaces (for Apache Cassandra) schema to be easily managed in AWS CloudFormation stacks.
The tool currently supports the following statements:
CREATE KEYSPACECREATE TABLEUSEExample Usage
Given a CQL script named
my_cql_script.cqlrun the tool by executing
this will produce a CFN template named
my_cfn_template.jsonThe tool requires one argument, the path to the CQL script to be converted. An optional second argument can be supplied to specify the path to the generated CFN template; otherwise, the generated CFN template is printed out to the standard output.
By default, the tool operates in relaxed mode, in which case it only gives warnings about the following issues:
IF NOT EXISTSThese warnings can be turned into errors by supplying the
--strictoption to the tool.A help message can be printed out by using the
--helpoption.How to build the tool
The tool needs to be built from source by running the following on Linux/MacOS…
on Microsoft Windows, run…
JDK 11 or later is required for building the tool.
After it is built successfully, the executable can be found in
./build/install/cql2cfn/bin/cql2cfn.Testing
To execute tests on Linux/MacOS use…
On Microsoft Windows use…