I'm trying to integrate a NoSQL database to store JSON data, rather than a SQL database to store JSON data (A column that stores a JSON object).
For MongoDB, I can insert a JSON file just by doing:
document = <JSON OBJECT>
collection.insert(document)
However, for Cassandra, according to this webpage: http://www.datastax.com/dev/blog/whats-new-in-cassandra-2-2-json-support
It cannot be schema less, meaning that I would need to create a table beforehand:
CREATE TABLE users (
id text PRIMARY KEY,
age int,
state text
);
And then insert the data:
INSERT INTO users JSON '{"id": "user123", "age": 42, "state": "TX"}';
The issue is that I want to try and use Cassandra, I've just completed DataStax's tutorial, but it seems that I would need to know the keys of the JSON data beforehand, which is not possible.
Or should I alter the table when there is a new data column if there is an unknown key? That doesn't sound like a very good design decision.
Can anyone point me to the right direction? Thanks