Cassandra Export - borkdominik/bigER GitHub Wiki

The Cassandra export generates a Cassandra Query Language (CQL) script that creates a keyspace and tables for each of the model elements similarly to SQL. Relationships are additionally marked with a comment.

Example

ER Model

erdiagram BasicExample

entity E1 {
    a1: int key
    a2: string
}
entity E2 {
    a3: int key
    a4: double
}
relationship R1 {
    E1[1] -> E2[N] 
}

Cassandra Export

CREATE KEYSPACE BasicExample WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 2};
USE BasicExample;

CREATE TABLE E1(
    a1 INT,
    a2 TEXT,
    PRIMARY KEY (a1)
);

CREATE TABLE E2(
    a3 INT,
    a4 DOUBLE,
    PRIMARY KEY (a3)
);

CREATE TABLE R1(
    a1 INT,
    a3 INT,
    PRIMARY KEY (a1, a3)
) WITH comment='relationship';