As always with Cassandra data modeling, you must start with your intended
query and access patterns as well as the cardinality of your data.

So, what information is your app likely to have when it needs to perform a
query and what information is it going to want to retrieve? What is the
full range of potential queries? Which are the most common and need to be
the fastest?


-- Jack Krupansky

On Mon, Mar 28, 2016 at 12:10 PM, Lokesh Ceeba - Vendor <
lokesh.ce...@walmart.com> wrote:

> Hello Team,
>
>                How to design/develop the best data model for this JSON ?
>
>
>
>
>
> 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 ***
>

Reply via email to