Reputation: 602
How can I insert json objects to Cassandra table without creating table? Can Cassandra parse json to table which is not created? Or, Can I create a table with no column and insert json?
Thanks.
Upvotes: 2
Views: 6830
Reputation: 810
After Cassandra 2.2 you can insert json directly, but the table still should be created beforehead.
Upvotes: 4
Reputation: 12840
You need to create table First, then you can insert data
You can create table like the below one :
CREATE TABLE json_data (
id timeuuid PRIMARY KEY,
data text
);
And you can insert the json as string with the below query :
INSERT INTO json_data (id , data ) VALUES ( now(), '{"first_name" : "Ashraful", "last_name" : "Islam"}') ;
Upvotes: 4