Triton — a Cassandra ORM for Elixir
After a season of battle-tested production use at Sleeper, I’m happy to open source Triton, a Cassandra ORM for Elixir!
Triton makes is easier to work with Cassandra.
Features include:
- Easily declare keyspaces, tables, and materialized views
- Automatic compile-time keyspace, table, and materialized view creation
- Multi-cluster configuration support
- Compile-time setup hooks for inserting required data
- Automatic data validation
- Automatic data transformation
Triton is built on top of Xandra.
Code Examples
Defining a table:
If the table or materialized views do not exist, Triton creates it for you at compile time.
Defining a materialized view:
Querying:
Updating:
There’s more examples on the github page.
Why not make Cassandra work with Ecto?
Ecto was primarily designed for relational databases, and has a lot of features that are RDBMS-specific but make no sense in the context of Cassandra data modeling.
We would be constantly trying to fit a square peg into a round hole.
Snowflake ID generation
In addition to Triton, we also open sourced Snowflake, a distributed snowflake ID generator in Elixir.
Happy New Year!