Reputation: 1549
I need to store some events inside a Cassandra Table. I had working a lot with habse and I am new to the cassandra data modeling.
the events are identifyed by a type and they have some attributes. the attributes don't have a fixed type and potentially they don't have a fixed lenght.
The JSON that describe an event:
{
obj_id: <identify the object that the event is related>
timestamp: <timestamp of the event>
type: <type of the event>
attributes: {
attribute1: value
attribute2: value
......
}
}
The query should extract all events of a specific type with related attributes.
I have figured out two scenarios:
Map<String,Byte>
. I will deserialize the type on extractionI don't know which pick of the two scenarios.
Upvotes: 0
Views: 195
Reputation: 16400
you can have a map<text, blob>
attributes
in your table if you want a simple 1:1 to your object. I would recommend considering how your going to query your data and model around that however. That said if you are just using this as a single object store and retrieval it can be as simple as:
CREATE TABLE object (
obj_id text PRIMARY KEY,
created timestamp,
type text,
attributes map<text, blob>
);
Upvotes: 1