Database Reference
In-Depth Information
Here I am sharing a CQL3 compatible implementation to generate .db files for
CQL3 tables. This is the extended implementation of the preceding shared URL.
In this example we will create a table having a column of the collection type. Let's
start!
1.
First we need to create keyspace Cql3Demo and table Users :
create keyspace "Cql3Demo" with replication
= { 'class' :
'SimpleStrategy', 'replication_factor':3};
use "Cql3Demo";
create table "Users"(user_id uuid PRIMARY
KEY,firstname text,lastname text,
password text,email text, age int, addresses
set<text>);
2.
Create a .csv file ( CSVInput.csv ) having a user ID, first name,
last name, password, email address, and age as follows:
5bd8c586-ae44-11e0-97b8-0026b0ea8cd0,vivek,mishra,4Jc2s,22,vivek.mishra@nomail.com
4bd8cb58-ae44-12e0-a2b8-0026b0ed9cd1,apress,bigdata,s!a0ml,12,bigdata@nomail.com
1ce7cb58-ae44-12e0-a2b8-0026b0ad21ab,Brian,Neil,s)3B3,12,brian.neil@nomail.com
3.
Now, let's have a look at implementation. It's a Maven-based project
and requires that we add the following dependency in pom.xml :
<dependency>
<groupId> org . apache . cassandra </groupId>
<artifactId> cassandra -all</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId> org . apache . cassandra </groupId>
<artifactId> cassandra - clientutil </artifactId>
<version>2.0.4</version>
</dependency>
Search WWH ::




Custom Search