I am trying to integrate a NoSQL database to store JSON data, not an SQL database to store JSON data (the column in which the JSON object is stored).
For MongoDB, I can insert a JSON file by simply doing:
document = <JSON OBJECT> collection.insert(document)
However, for Kassandra, according to this web page: http://www.datastax.com/dev/blog/whats-new-in-cassandra-2-2-json-support
This cannot be less than a schema, which means that I will need to create a table in advance:
CREATE TABLE users ( id text PRIMARY KEY, age int, state text );
And then paste the data:
INSERT INTO users JSON '{"id": "user123", "age": 42, "state": "TX"}';
The problem is that I want to try using Cassandra, I just finished the DataStax tutorial, but it seems to me that I need to know the JSON data keys in advance, which is impossible.
Or do I need to change the table when there is a new data column, if there is an unknown key? This does not seem like a very good design decision.
Can someone point me in the right direction? Thanks
source share