Cassandra SQL Exporter


Given ALFA objects can be flattened to relational structures, generating SQL/relational table structures was a next logical step.

Apache Cassandra was selected as a candidate store purely for the ease in testing the SQL CREATE statements in the JVM as part of unit tests on the generated SQL statements.

Other BigData/NoSQL Database SQL can easily be generated by extending this exporter.

Please note this exporter is highly experimental at this stage and is likely to change to be better aligned with the flattened table<T> column structures.

Usage Steps

  • Similar to generating Java and CSharp, Python is generated using the following commandline.
alfa -c -e cassandra -o generated/csql src


Given the following data model below, the Cassandra Exporter will generate a Create table SQL.

record SalesPerson {
    Name : string
    Customers : list< Customer >

record Customer {
    Id : uuid
    Name : string
    DateOfBirth : date
    Accounts : set< string >
    CustomerType : enum< Standard, Gold, Platinum >

Generated Cassandra SQL:

CREATE TABLE demo.SalesPerson (
   genKey__ uuid PRIMARY KEY,
   Name text,
   Customers_seqIndex bigint,
   Id uuid,
   entry_Name text,
   DateOfBirth date,
   Accounts_setIndex bigint,
   Accounts text,
   CustomerType text