Open In App

Expand on command in Cassandra

Last Updated : 20 Jan, 2020
Like Article

Prerequisite – Cassandra
In this article, we are going to discuss cqlsh shell command like expand on, expand off, describe keyspace, describe the table and also discuss with implemented cqlsh query.

First, we are going to create keyspace in cqlsh. Below given is cqlsh Query for creating a keyspace.

create keyspace cluster1
with REPLICATION = {'class' : 'SimpleStrategy', 

Now, after successfully created cluter1 keyspace. we are going to use it for creating a table.

use cluster1;

cqlsh:cluster1> create table inbox_search
  key_id UUID primary key,
  keyword_name text,
  status text

Now, we are going to insert some data into the table(inbox_search).

Insert into inbox_search(key_id, keyword_name, status)
values(uuid(), 'inbox', 'active');

Insert into inbox_search(key_id, keyword_name, status)
values(uuid(), 'profile', 'ok');

Insert into inbox_search(key_id, keyword_name, status)
values(uuid(), 'Ashish', 'done'); 

Now, to verify the results see the output and implemented cqlsh query given below.

To verify the keyspace used the following cqlsh query.

To verify the table used the following cqlsh query.

To verify the use keyspace command used the following cqlsh query.

Now, we are going to discuss expand on command in cqlsh. expand on command is used to expanding the results into separate rows. let’s have a look.

Now, we can also use expand off command to not expand the results and In general, Expand off is by default. given below is an implemented cqlsh query to verify the results of how it works.

Similar Reads

Static type using batch in Cassandra
Prerequisite - Cassandra In this article, we will discuss the static column using the BATCH statement and how it works with the BATCH statement. Static column can be used for conditional update using a batch statement. Let’s have a look. Let's consider bank_emp_details is a table name and Id, Name, Bank_name, E_start_date and E_end_date are the fie
2 min read
High Availability Mechanism in Cassandra
In this article we will learn about mechanism of high availability in Cassandra by using the following key terminology. 1. Seed Node 2. Gossip Communication Protocol 3. Failure Detection 4. Hinted Handoff lets discuss one by one. 1. Seed Node: In Apache Cassandra it is first nodes to start in cluster. If we want to Configured seed node, then we can
5 min read
Apache Cassandra tools
Prerequisites - Introduction to Apache Cassandra Apache Cassandra (NOSQL database) Architecture of Apache Cassandra In this article, we are going to discuss the tools of Apache Cassandra which help to perform in various aspects of tasks such that the status of the node, the status of the ring, back up and restore data, etc. The CQL shell (cqlsh) -
3 min read
Blob conversion function in Cassandra
In Cassandra, Blob data type represents constant hexadecimal data type and the number is defined as 0[xX](hex)+ where hex means hexadecimal. It is useful to store a short string or small images. In this article we will discuss Blob conversion function which converts the native types into binary data (blob): typeAsBlob(value) blobAsType(value) Let's
1 min read
Designing models in Cassandra
Prerequisite - Introduction to Cassandra, Overview of Data Modelling In this article, we are going to discuss how we can Designing the model in Cassandra. Modelling design is one of the key part for any application. So, let's discuss how we can make a better model for any application with an example we will see how we can do that. As you will see C
4 min read
Apache Cassandra (NOSQL database)
In this article, we will learn the basics of Apache Cassandra and the basics of CQL (Cassandra Query Language) operations like Create, insert, delete, select, etc. Apache Cassandra: Apache Cassandra is an open-source no SQL database that is used for handling big data. Apache Cassandra has the capability to handle structure, semi-structured, and uns
3 min read
Architecture of Apache Cassandra
Avinash Lakshman and Prashant Malik initially developed Cassandra at Facebook to power the Facebook inbox search feature. Facebook released Cassandra as an open source project on google code in July 2008. It became an Apache incubator project in March 2009. It became one of the top level project in 17 Feb 2010. Fueled by the internet revolution, mo
5 min read
Overview of User Defined Type (UDT) in Cassandra
User Defined Data Type: One of the advantages of User Defined Data(UDT) is to Attach multiple data fields to a column. In Cassandra, UDTs play a vital role which allows group related fields (such that field 1, field 2, etc.) can be of data together and are named and type. In Cassandra one of the advantage of UDTs which helps to add flexibility to y
4 min read
Overview of Data modeling in Apache Cassandra
In this article we will learn about these three data model in Cassandra: Conceptual, Logical, and Physical. Learning Objective: To Build database using quick design techniques in Cassandra. To Improve existing model using a query driven methodology in Cassandra. To Optimize Existing model via analysis and validation techniques in Cassandra. Data mo
3 min read
Concept of indexing in Apache Cassandra
Prerequisite - Introduction to Apache Cassandra Index: As we can access data using attributes which having the partition key. For Example, if Emp_id is a column name for Employee table and if it is partition key of that table then we can filter or search data with the help of partition key. In this case we can used WHERE clause to define condition
5 min read
Article Tags :