Migrating SQL applications to Cassandra – Pattern #1

This series of posts is specific for Ohioedge Jeebuilder however patterns adopted should be generic enough for any SQL->Cassandra migration.

Pattern #1: Get rid of all sql joins and move join-logic in the middle-tier. For example, consider a typical SQL query to find all employees of an employer:
select er1.employerName, ee1.employeeName
from employee ee1, employer er1
where ee1.employerID = er1.employerID
and er1.employerName = ?1

To make this work in Cassandra, we need to split this query in two:
Query #1: Employee-query
select *
from employee
where employerID = ?1

Query#2: Employer-query
select *
from employer
where employerName = ?1

and let Ohioedge Jeebuilder generate the graph (by internally first executing employer-query and then executing employee-query for the found employer):


employerTO.colOfEmployeeTO

The split two queries are Cassandra compliant and join-logic is now in the middle-tier.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s