What is CQL?

CQL is simple api mean for accessing Cassandra.CQL adds an abstraction layer that hides implementation details of this structure and provides native syntaxes for collections and other common encodings.

Common ways to access CQL are:
• Start cqlsh, the Python-based command-line client, on the command line of a Cassandra node.
• For developing applications, use one of the C#, Java, or Python open-source drivers.
• Use the set_cql_version Thrift method for programmatic access
Below are common operation we can do with CQL

1. Creating and using key space:
cqlsh> CREATE KEYSPACE demodb WITH REPLICATION = { ‘class’ :
‘NetworkTopologyStrategy’, ‘datacenter1’ : 3 };
USE demodb;

2. Alter Key Space
ALTER KEYSPACE ” demodb ” WITH REPLICATION = { ‘class’ : ‘SimpleStrategy’,
‘replication_factor’ : 2};

Get started with our comprehensive Cassandra tutorial.

Certification in Bigdata Analytics

3. Create Table
CREATE TABLE emp ( empID int, deptID int, first_name varchar,last_name varchar, PRIMARY KEY (empID, deptID));

4. Insert into table
INSERT INTO emp (empID, deptID, first_name, last_name) VALUES (104, 15, ‘jane’, ‘smith’);

5. Select query Select * from emp;
Scaling online library with Cassandra
Let’s talk about a very simple example of online books library. In relation database the system will have multiple normalized schemas. Few of very important one are described below:

CQL tutorial

As with introduction of “free users” and “unlimited books at my dispose” features in online book library, popularity of app increased to great extend .Resultant was flood of customer data. These made RDBMS setup unstable and business decided to go with Cassandra to mitigate the issue.
Before designing Cassandra table we need to find out all possible queries which key space shall support.

Learn from MapReduce Experts by enrolling in MapReduce Training.

Most fired queries would be:
1. Get books of category with availability >0
2. Get books from same author Queries for business point of view
3. Get Customer liking per geographic location
4. Most liked category
So in order to incorporate this quicker we need to de-normalize data and create new column families.

img 7
A detailed understanding of Apache Cassandra is available in this blog post for your perusal!

Course Schedule

Name Date Details
Big Data Course 30 Mar 2024(Sat-Sun) Weekend Batch
View Details
Big Data Course 06 Apr 2024(Sat-Sun) Weekend Batch
View Details
Big Data Course 13 Apr 2024(Sat-Sun) Weekend Batch
View Details

Find MongoDB Training in Other Regions

Bangalore Chennai Delhi Hyderabad London Sydney United States