NEW  New: cqlint (lint + format), cql-migrate and cqlprof → see the benchmarks

Examples

Small projects that run against a real ScyllaDB. All of them are in the cqlz repository.

cqlc, schema-first

KillrVideo

The real 3.x schema from KillrVideo/killrvideo-data (Apache-2.0): 14 tables with counters, static columns and clustering orders. The 13 queries were written for this example following the access patterns the schema comments describe. cqlc checks them offline and generates typed Rust; the demo runs every generated function against a live node.

cd examples/killrvideo-cqlc
cqlc check                     # ok: 13 queries checked
cqlc generate                  # wrote src/queries.rs (13 queries)
CQLC_NODE=127.0.0.1:9042 cargo run
videos of user, newest first: ["Compaction explained", "Data modeling", "Intro to Cassandra"]
playback views: Some(Counter(4))
ok: 13 generated queries exercised against the real KillrVideo schema
Source
cqlx, code-first

IoT sensor telemetry

The "sensor" model from DataStax's data-modeling-by-example, as one Rust struct. Readings are bucketed by day so partitions stay bounded, inserts are typed, and every read is a type-state query: fetch does not exist until both partition keys are set.

#[derive(CqlEntity, DeserializeRow)]
#[cqlx(table_name = "readings", keyspace = "iot")]
struct Reading {
    #[cqlx(partition_key)] sensor_id: String,
    #[cqlx(partition_key)] day: i32,
    #[cqlx(clustering_key(order = "desc"))] ts: i64,
    temperature: f64,
    humidity: f64,
}

Reading::query().sensor_id("sensor-007".into()).day(20_001).limit(3).fetch(&session).await?;
inserted 150000 readings in 2.60s (57639/s)       # one laptop, Docker ScyllaDB
latest 3 of sensor-007 on day 20001: [(86313600, 27.9), (86227200, 27.8), (86140800, 27.7)]
range query returned 10 rows
Source
cqlz-gym

Table design on domain workloads

Three workloads modelled after KillrVideo's access patterns and two DataStax data-modeling-by-example domains (sensors, shopping cart and orders). They are hand-modelled workloads, not those projects' datasets. Each design was loaded into a real ScyllaDB and measured.

WorkloadTables naive → bestModel cost, naive → bestMeasured ops/s
KillrVideo (7 queries)7 → 73,542 → 3,542noise
Sensors (6 queries)6 → 5118,704 → 91,195+8.2 %
Shop and carts (7 queries)7 → 627,529 → 26,029+1.4 %

Sensors: merging the two read patterns that share a partition key saves 23 % in the model and 7.6 % latency on the real database. KillrVideo: there is nothing to merge, so every method agrees. More on cqlz-gym.

cargo install cqlz-gym
cqlz-gym solve examples/gym-workloads/sensors.toml --policy hf --emit out/
Workloads