cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Svihla ...@foundev.pro>
Subject Re: What is the best way to model this JSON ??
Date Mon, 28 Mar 2016 16:28:55 GMT
Lokesh,

The modeling will change a bit depending on your queries, the rate of update and your tooling
(Spring-data-cassandra makes a mess of updating collections for example).  I suggest asking
the Cassandra users mailing list for help since this list is for development OF Cassandra.

> On Mar 28, 2016, at 11:09 AM, Lokesh Ceeba - Vendor <Lokesh.Ceeba@walmart.com>
wrote:
> 
> Hello Team,
>               How to design/develop the best data model for this ?
> 
> 
> var json=[    { "id":"9a55fdf6-eeab-4c83-9c6f-04c7df1b3225",
>                "user":"ssatish",
>                "event":"business",
>                "occurredOn":"09 Mar 2016 17:55:15.292-0600",
>                "eventObject":
>                {
>                                "objectType":"LOAD",
>                                "id":"12345",
>                                "state":"ARRIVAL",
>                                "associatedAttrs":
>                                [
>                                                {
>                                                                "type":"location_id",
>                                                                "value":"100"
>                                                },
>                                                {
>                                                                "type":"location_type",
>                                                                "value":"STORE"
>                                                },
>                                                {
>                                                                "type":"arrival_ts",
>                                                                "value":"2015-12-12T10:10:10"
>                                                }
>                                ]
> } }]
> 
> 
> I've taken this approach :
> 
> create type event_object_0328
> (
> Object_Type text,
> Object_ID   Int,
> Object_State text
> )
> ;
> 
> 
> create table Events
> (
> event_id       timeuuid,
> event_type     text,
> triggered_by   text,
> triggered_ts   timestamp,
> Appl_ID        text,
> eventObject    frozen<event_object_0328>,
> primary key    (event_id)
> )
> ;
> 
> Now I need to build the Associated Attributes (Highlighted above in JSON text). The Associated
Attributes can be very dynamic and shall come in any (Key,Value) pair combination.
> 
> 
> 
> 
> --
> Lokesh
> 
> This email and any files transmitted with it are confidential and intended solely for
the individual or entity to whom they are addressed. If you have received this email in error
destroy it immediately. *** Walmart Confidential ***


Mime
View raw message