Database Reference
In-Depth Information
Let's discuss this with a sample exercise.
1.
First, let's prepare the schema and populate some data:
create keyspace sample_backup with
replication = {
'class':'SimpleStrategy','replication_factor':2};
// create keyspace
use sample_backup ; // set keyspace
// create table
create table twitter(hashtag timeuuid primary
key, account_name text, tweets set<text>);
// insert records
insert into
twitter(hashtag,account_name,tweets)
values(now(),'apress_pub',{'New book on
Cassandra is out'});
insert into
twitter(hashtag,account_name,tweets)
values(now(),'thenews',{'Obama meeting with
European allies on Ukraine http://t.co/
l8P8bPcbom from #APress','Bergdahl uproar
halts plan for return celebration http://t.co/
BhF6kMy5pW from #APress'});
2.
Verify the records have been persisted successfully with the select
command:
select * from twitter;
hashtag |
account_name | tweets
--------------------------------------+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------
12da45f0-2702-11e4-861b-9d03f52e8a2b |
apress_pub | {'New book on Cassandra is out'}
Search WWH ::




Custom Search