Neo4j meets Cassandra :)
Hi!
- Computer Engineer
- Programming
- Electronics
- Math <3 <3
- Physics
- Lego
- Meetups
- Animals
- Coffee
- GIFs
Graphs are everywhere
We had a talk about MongoDB + Neo4j
Cassandra!
A short intro about Cassandra
Cassandra's data Model
Item
Item
Feature
Item
Item
Feature
Feature
Screen
Item
Item
Feature
Item
Item
Feature
Feature
Screen
App
Cassandra + Neo4j <3
- Recommendation systems
- Relationships discovery
- Optimised paths
neo4j-cassandra-connector
https://github.com/hannelita/neo4j_doc_manager
Main challenge:
Flexibility over mapping via configuration file
CREATE TABLE playlist.statistics:
counter_name text PRIMARY KEY: {i}
counter_value counter: {p}
CREATE TABLE playlist.track_by_artist:
artist text: {r}
track text: {p}
track_id uuid: {i}
genre text: {p}
music_file text: {p}
starred boolean: {p}
track_length_in_seconds int: {p}
PRIMARY KEY (artist {i}, track {p}, track_id {i})
Get a Cassandra Schema
Specify which are properties, or nodes or relationships
{ } => customisable mapping
Each row will be turned into a node
Project Style
CREATE TABLE playlist.statistics:
counter_name text PRIMARY KEY: {i}
counter_value counter: {p}
CREATE TABLE playlist.track_by_artist:
artist text: {r}
track text: {p}
track_id uuid: {i}
genre text: {p}
music_file text: {p}
starred boolean: {p}
track_length_in_seconds int: {p}
PRIMARY KEY (artist {i}, track {p}, track_id {i})
Node Labels
Project Style
CREATE TABLE playlist.statistics:
counter_name text PRIMARY KEY: {i}
counter_value counter: {p}
CREATE TABLE playlist.track_by_artist:
artist text: {r}
track text: {p}
track_id uuid: {i}
genre text: {p}
music_file text: {p}
starred boolean: {p}
track_length_in_seconds int: {p}
PRIMARY KEY (artist {i}, track {p}, track_id {i})
Node Properties:
flexible
Project Style
CREATE TABLE playlist.track_by_artist:
artist text: {r}
track text: {p}
track_id uuid: {i}
genre text: {p}
music_file text: {p}
starred boolean: {p}
track_length_in_seconds int: {p}
PRIMARY KEY (artist {i}, track {p}, track_id {i})
CREATE TABLE playlist.track_by_id:
track_id uuid PRIMARY KEY: {u}
artist text: {r}
genre text: {p}
music_file text: {p}
track text: {p}
track_length_in_seconds int: {p}
Relationship
Project Style
CREATE TABLE playlist.track_by_artist:
artist text: {r}
track text: {p}
track_id uuid: {i}
genre text: {p}
music_file text: {p}
starred boolean: {p}
track_length_in_seconds int: {p}
PRIMARY KEY (artist {i}, track {p}, track_id {i})
CREATE TABLE playlist.track_by_id:
track_id uuid PRIMARY KEY: {u}
artist text: {r}
genre text: {p}
music_file text: {p}
track text: {p}
track_length_in_seconds int: {p}
Relationship
Project Style
CREATE TABLE playlist.track_by_artist:
artist text: {r}
track text: {p}
track_id uuid: {i}
genre text: {p}
music_file text: {p}
starred boolean: {p}
track_length_in_seconds int: {p}
PRIMARY KEY (artist {i}, track {p}, track_id {i})
CREATE TABLE playlist.track_by_id:
track_id uuid PRIMARY KEY: {u}
artist text: {r}
genre text: {p}
music_file text: {p}
track text: {p}
track_length_in_seconds int: {p}
Uniques and Indexes
Project Style
CREATE TABLE playlist.playlist_tracks:
username text: {p}
playlist_name text: {p}
sequence_no timestamp: {p}
artist text: {r}
genre text: {p}
track_id uuid: {i}
track_length_in_seconds int: {p}
track_name text: {p}
PRIMARY KEY ((username {p}, playlist_name {p}) {p}, sequence_no {p})
Also works for inline schema
Challenges
- Parsers!
- Data Structures
- Keep code healthy
- Levels of flexibility
- Performance!
- Open Source! :)
Further work
- Make it smarter
- Inference for the schema
- Query Optimizer
Special Thanks
- @lyonwj
- @mesirii (Michael Hunger) and @ryguyrg
- @neo4j
- @lafp, @romulostores and @pedrofelipee (GIFs)
Thank you :)
Questions?
hannelita@gmail.com
@hannelita
Neo4j meets Cassandra :)
By Hanneli Tavante (hannelita)
Neo4j meets Cassandra :)
- 5,740