RE: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Rajeswari Menon
Ok, got it. Many thanks for your help.

Regards,
Rajeswari
From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 11:30
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

When you run a cql query like select Json from table where pk=?  , you will get 
the value which is a full Json .but if you have a requirement to query the Json 
by using some fields inside Json ,you have to create additional columns for 
that fields and create a secondary index on it .
Then you can query
select Json from table where address=?,assuming you created a secondary index 
on address column .
Regards
Hari

Sent from my iPhone

On Feb 1, 2017, at 9:18 PM, Rajeswari Menon 
> wrote:
Could you please help me on this. I am a newbie in Cassandra. So If I need to 
add json as a String, I can define the table as below.

create table data
(
  id int primary key,
  json text
);

The insert query will be as follows:

insert into data (id, json) values (1, '{
   "address":"127.0.0.1",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "Id":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}');

Now how can I query the value field?


From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 10:18
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You can create additional columns and create secondary index based on fields 
you want to query .
Best option is store full Json in Cassandra and index fields you want to query 
on in solr .

Sent from my iPhone

On Feb 1, 2017, at 8:41 PM, Rajeswari Menon 
> wrote:
Yes. I know that. My intension is to do an aggregate query on value field (in 
json). Will that be possible if I store the entire json as String? I will have 
to parse it according to my need right?

Regards,
Rajeswari

From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 10:08
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You can use text type in Cassandra and store the full Json  string .

Sent from my iPhone

On Feb 1, 2017, at 8:30 PM, Rajeswari Menon 
> wrote:
Yes. Is there any way to define value to accept any data type as the json value 
data may vary? Or is there any way to do the same without defining a schema?

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 15:36
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

Value is defined as text column and you try to insert a double. That's simply 
not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" 
>:
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but 

Re: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Harikrishnan Pillai
When you run a cql query like select Json from table where pk=?  , you will get 
the value which is a full Json .but if you have a requirement to query the Json 
by using some fields inside Json ,you have to create additional columns for 
that fields and create a secondary index on it .
Then you can query
select Json from table where address=?,assuming you created a secondary index 
on address column .
Regards
Hari

Sent from my iPhone

On Feb 1, 2017, at 9:18 PM, Rajeswari Menon 
> wrote:

Could you please help me on this. I am a newbie in Cassandra. So If I need to 
add json as a String, I can define the table as below.

create table data
(
  id int primary key,
  json text
);

The insert query will be as follows:

insert into data (id, json) values (1, '{
   "address":"127.0.0.1",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "Id":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}');

Now how can I query the value field?


From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 10:18
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You can create additional columns and create secondary index based on fields 
you want to query .
Best option is store full Json in Cassandra and index fields you want to query 
on in solr .

Sent from my iPhone

On Feb 1, 2017, at 8:41 PM, Rajeswari Menon 
> wrote:
Yes. I know that. My intension is to do an aggregate query on value field (in 
json). Will that be possible if I store the entire json as String? I will have 
to parse it according to my need right?

Regards,
Rajeswari

From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 10:08
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You can use text type in Cassandra and store the full Json  string .

Sent from my iPhone

On Feb 1, 2017, at 8:30 PM, Rajeswari Menon 
> wrote:
Yes. Is there any way to define value to accept any data type as the json value 
data may vary? Or is there any way to do the same without defining a schema?

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 15:36
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

Value is defined as text column and you try to insert a double. That's simply 
not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" 
>:
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but got a Double: 1.390692. The 
message is clear that a double value cannot be inserted to text column. The 
real issue is that the value can be of any data type, so the schema cannot be 
predefined. Is there a way to create a column which can hold value of any data 
type. (I 

RE: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Rajeswari Menon
Ok, got it. Many thanks for your help.

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 02 February 2017 11:09
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

This has to be done in your app. You can store your data as JSON in a text 
column. You can use your favourite serializer. You can cast floats to strings. 
You can even build a custom type. You can store it serialized as blob. But 
there is no all purpose store all data in a magic way field.

Am 02.02.2017 05:30 schrieb "Rajeswari Menon" 
>:
Yes. Is there any way to define value to accept any data type as the json value 
data may vary? Or is there any way to do the same without defining a schema?

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 15:36
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

Value is defined as text column and you try to insert a double. That's simply 
not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" 
>:
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but got a Double: 1.390692. The 
message is clear that a double value cannot be inserted to text column. The 
real issue is that the value can be of any data type, so the schema cannot be 
predefined. Is there a way to create a column which can hold value of any data 
type. (I don’t want to hold the entire json as string. My preferred way is to 
define a schema.)

Regards,
Rajeswari



--
Benjamin Roth
Prokurist

Jaumo GmbH · www.jaumo.com
Wehrstraße 46 · 73035 Göppingen · Germany
Phone +49 7161 304880-6 · Fax +49 7161 
304880-1
AG Ulm · HRB 731058 · Managing Director: Jens Kammerer


RE: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Benjamin Roth
This has to be done in your app. You can store your data as JSON in a text
column. You can use your favourite serializer. You can cast floats to
strings. You can even build a custom type. You can store it serialized as
blob. But there is no all purpose store all data in a magic way field.

Am 02.02.2017 05:30 schrieb "Rajeswari Menon" :

> Yes. Is there any way to define value to accept any data type as the json
> value data may vary? Or is there any way to do the same without defining a
> schema?
>
>
>
> Regards,
>
> Rajeswari
>
>
>
> *From:* Benjamin Roth [mailto:benjamin.r...@jaumo.com]
> *Sent:* 01 February 2017 15:36
> *To:* user@cassandra.apache.org
> *Subject:* RE: Is it possible to have a column which can hold any data
> type (for inserting as json)
>
>
>
> Value is defined as text column and you try to insert a double. That's
> simply not allowed
>
>
>
> Am 01.02.2017 09:02 schrieb "Rajeswari Menon" :
>
> Given below is the sql query I executed.
>
>
>
> *insert* *into* data JSON'{
>
>   "id": 1,
>
>"address":"",
>
>"datatype":"DOUBLE",
>
>"name":"Longitude",
>
>"attributes":{
>
>   "ID":"1"
>
>},
>
>"category":"REAL",
>
>"value":1.390692,
>
>"timestamp":1485923271718,
>
>"quality":"GOOD"
>
> }';
>
>
>
> Regards,
>
> Rajeswari
>
>
>
> *From:* Benjamin Roth [mailto:benjamin.r...@jaumo.com]
> *Sent:* 01 February 2017 12:35
> *To:* user@cassandra.apache.org
> *Subject:* Re: Is it possible to have a column which can hold any data
> type (for inserting as json)
>
>
>
> You should post the whole CQL query you try to execute! Why don't you use
> a native JSON type for your JSON data?
>
>
>
> 2017-02-01 7:51 GMT+01:00 Rajeswari Menon :
>
> Hi,
>
>
>
> I have a json data as shown below.
>
>
>
> {
>
> "address":"127.0.0.1",
>
> "datatype":"DOUBLE",
>
> "name":"Longitude",
>
>  "attributes":{
>
> "Id":"1"
>
> },
>
> "category":"REAL",
>
> "value":1.390692,
>
> "timestamp":1485923271718,
>
> "quality":"GOOD"
>
> }
>
>
>
> To store the above json to Cassandra, I defined a table as shown below
>
>
>
> *create* *table* data
>
> (
>
>   id *int* *primary* *key*,
>
>   address text,
>
>   datatype text,
>
>   name text,
>
>   *attributes* *map* < text, text >,
>
>   category text,
>
>   value text,
>
>   "timestamp" *timestamp*,
>
>   quality text
>
> );
>
>
>
> When I try to insert the data as JSON I got the error : *Error decoding
> JSON value for value: Expected a UTF-8 string, but got a Double: 1.390692*.
> The message is clear that a double value cannot be inserted to text column.
> The real issue is that the value can be of any data type, so the schema
> cannot be predefined. Is there a way to create a column which can hold
> value of any data type. (I don’t want to hold the entire json as string. My
> preferred way is to define a schema.)
>
>
>
> Regards,
>
> Rajeswari
>
>
>
>
>
> --
>
> Benjamin Roth
> Prokurist
>
> Jaumo GmbH · www.jaumo.com
> Wehrstraße 46 · 73035 Göppingen · Germany
> Phone +49 7161 304880-6 <07161%203048806> · Fax +49 7161 304880-1
> <07161%203048801>
> AG Ulm · HRB 731058 · Managing Director: Jens Kammerer
>
>


RE: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Rajeswari Menon
Could you please help me on this. I am a newbie in Cassandra. So If I need to 
add json as a String, I can define the table as below.

create table data
(
  id int primary key,
  json text
);

The insert query will be as follows:

insert into data (id, json) values (1, '{
   "address":"127.0.0.1",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "Id":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}');

Now how can I query the value field?


From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 10:18
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You can create additional columns and create secondary index based on fields 
you want to query .
Best option is store full Json in Cassandra and index fields you want to query 
on in solr .

Sent from my iPhone

On Feb 1, 2017, at 8:41 PM, Rajeswari Menon 
> wrote:
Yes. I know that. My intension is to do an aggregate query on value field (in 
json). Will that be possible if I store the entire json as String? I will have 
to parse it according to my need right?

Regards,
Rajeswari

From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 10:08
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You can use text type in Cassandra and store the full Json  string .

Sent from my iPhone

On Feb 1, 2017, at 8:30 PM, Rajeswari Menon 
> wrote:
Yes. Is there any way to define value to accept any data type as the json value 
data may vary? Or is there any way to do the same without defining a schema?

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 15:36
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

Value is defined as text column and you try to insert a double. That's simply 
not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" 
>:
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but got a Double: 1.390692. The 
message is clear that a double value cannot be inserted to text column. The 
real issue is that the value can be of any data type, so the schema cannot be 
predefined. Is there a way to create a column which can hold value of any data 
type. (I don't want to hold the entire json as string. My preferred way is to 
define a schema.)

Regards,
Rajeswari



--
Benjamin Roth
Prokurist

Jaumo GmbH · www.jaumo.com
Wehrstraße 46 · 73035 Göppingen · Germany
Phone +49 7161 304880-6 · Fax +49 7161 
304880-1
AG Ulm · HRB 731058 · Managing Director: Jens Kammerer


Re: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Harikrishnan Pillai
You can create additional columns and create secondary index based on fields 
you want to query .
Best option is store full Json in Cassandra and index fields you want to query 
on in solr .

Sent from my iPhone

On Feb 1, 2017, at 8:41 PM, Rajeswari Menon 
> wrote:

Yes. I know that. My intension is to do an aggregate query on value field (in 
json). Will that be possible if I store the entire json as String? I will have 
to parse it according to my need right?

Regards,
Rajeswari

From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 10:08
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You can use text type in Cassandra and store the full Json  string .

Sent from my iPhone

On Feb 1, 2017, at 8:30 PM, Rajeswari Menon 
> wrote:
Yes. Is there any way to define value to accept any data type as the json value 
data may vary? Or is there any way to do the same without defining a schema?

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 15:36
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

Value is defined as text column and you try to insert a double. That's simply 
not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" 
>:
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but got a Double: 1.390692. The 
message is clear that a double value cannot be inserted to text column. The 
real issue is that the value can be of any data type, so the schema cannot be 
predefined. Is there a way to create a column which can hold value of any data 
type. (I don't want to hold the entire json as string. My preferred way is to 
define a schema.)

Regards,
Rajeswari



--
Benjamin Roth
Prokurist

Jaumo GmbH * www.jaumo.com
Wehrstra?e 46 * 73035 G?ppingen * Germany
Phone +49 7161 304880-6 * Fax +49 7161 
304880-1
AG Ulm * HRB 731058 * Managing Director: Jens Kammerer


RE: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Rajeswari Menon
Yes. I know that. My intension is to do an aggregate query on value field (in 
json). Will that be possible if I store the entire json as String? I will have 
to parse it according to my need right?

Regards,
Rajeswari

From: Harikrishnan Pillai [mailto:hpil...@walmartlabs.com]
Sent: 02 February 2017 10:08
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You can use text type in Cassandra and store the full Json  string .

Sent from my iPhone

On Feb 1, 2017, at 8:30 PM, Rajeswari Menon 
> wrote:
Yes. Is there any way to define value to accept any data type as the json value 
data may vary? Or is there any way to do the same without defining a schema?

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 15:36
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

Value is defined as text column and you try to insert a double. That's simply 
not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" 
>:
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but got a Double: 1.390692. The 
message is clear that a double value cannot be inserted to text column. The 
real issue is that the value can be of any data type, so the schema cannot be 
predefined. Is there a way to create a column which can hold value of any data 
type. (I don't want to hold the entire json as string. My preferred way is to 
define a schema.)

Regards,
Rajeswari



--
Benjamin Roth
Prokurist

Jaumo GmbH · www.jaumo.com
Wehrstraße 46 · 73035 Göppingen · Germany
Phone +49 7161 304880-6 · Fax +49 7161 
304880-1
AG Ulm · HRB 731058 · Managing Director: Jens Kammerer


Re: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Harikrishnan Pillai
You can use text type in Cassandra and store the full Json  string .

Sent from my iPhone

On Feb 1, 2017, at 8:30 PM, Rajeswari Menon 
> wrote:

Yes. Is there any way to define value to accept any data type as the json value 
data may vary? Or is there any way to do the same without defining a schema?

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 15:36
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

Value is defined as text column and you try to insert a double. That's simply 
not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" 
>:
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but got a Double: 1.390692. The 
message is clear that a double value cannot be inserted to text column. The 
real issue is that the value can be of any data type, so the schema cannot be 
predefined. Is there a way to create a column which can hold value of any data 
type. (I don't want to hold the entire json as string. My preferred way is to 
define a schema.)

Regards,
Rajeswari



--
Benjamin Roth
Prokurist

Jaumo GmbH * www.jaumo.com
Wehrstra?e 46 * 73035 G?ppingen * Germany
Phone +49 7161 304880-6 * Fax +49 7161 
304880-1
AG Ulm * HRB 731058 * Managing Director: Jens Kammerer


RE: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Rajeswari Menon
Yes. Is there any way to define value to accept any data type as the json value 
data may vary? Or is there any way to do the same without defining a schema?

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 15:36
To: user@cassandra.apache.org
Subject: RE: Is it possible to have a column which can hold any data type (for 
inserting as json)

Value is defined as text column and you try to insert a double. That's simply 
not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" 
>:
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth 
[mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but got a Double: 1.390692. The 
message is clear that a double value cannot be inserted to text column. The 
real issue is that the value can be of any data type, so the schema cannot be 
predefined. Is there a way to create a column which can hold value of any data 
type. (I don’t want to hold the entire json as string. My preferred way is to 
define a schema.)

Regards,
Rajeswari



--
Benjamin Roth
Prokurist

Jaumo GmbH · www.jaumo.com
Wehrstraße 46 · 73035 Göppingen · Germany
Phone +49 7161 304880-6 · Fax +49 7161 
304880-1
AG Ulm · HRB 731058 · Managing Director: Jens Kammerer


Re: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Peter Reilly
Example:
cqlsh> use dc_god_emperor ;
cqlsh:dc_god_emperor> create table data ( id int primary key, value text ) ;
cqlsh:dc_god_emperor> insert into data JSON'{"id": 1, "value": "hello
world"}'
  ... ;
cqlsh:dc_god_emperor> select * from data;

 id | value
+-
  1 | hello world

(1 rows)

Peter

On Wed, Feb 1, 2017 at 3:06 AM, Benjamin Roth 
wrote:

> Value is defined as text column and you try to insert a double. That's
> simply not allowed
>
> Am 01.02.2017 09:02 schrieb "Rajeswari Menon" :
>
>> Given below is the sql query I executed.
>>
>>
>>
>> *insert* *into* data JSON'{
>>
>>   "id": 1,
>>
>>"address":"",
>>
>>"datatype":"DOUBLE",
>>
>>"name":"Longitude",
>>
>>"attributes":{
>>
>>   "ID":"1"
>>
>>},
>>
>>"category":"REAL",
>>
>>"value":1.390692,
>>
>>"timestamp":1485923271718,
>>
>>"quality":"GOOD"
>>
>> }';
>>
>>
>>
>> Regards,
>>
>> Rajeswari
>>
>>
>>
>> *From:* Benjamin Roth [mailto:benjamin.r...@jaumo.com]
>> *Sent:* 01 February 2017 12:35
>> *To:* user@cassandra.apache.org
>> *Subject:* Re: Is it possible to have a column which can hold any data
>> type (for inserting as json)
>>
>>
>>
>> You should post the whole CQL query you try to execute! Why don't you use
>> a native JSON type for your JSON data?
>>
>>
>>
>> 2017-02-01 7:51 GMT+01:00 Rajeswari Menon :
>>
>> Hi,
>>
>>
>>
>> I have a json data as shown below.
>>
>>
>>
>> {
>>
>> "address":"127.0.0.1",
>>
>> "datatype":"DOUBLE",
>>
>> "name":"Longitude",
>>
>>  "attributes":{
>>
>> "Id":"1"
>>
>> },
>>
>> "category":"REAL",
>>
>> "value":1.390692,
>>
>> "timestamp":1485923271718,
>>
>> "quality":"GOOD"
>>
>> }
>>
>>
>>
>> To store the above json to Cassandra, I defined a table as shown below
>>
>>
>>
>> *create* *table* data
>>
>> (
>>
>>   id *int* *primary* *key*,
>>
>>   address text,
>>
>>   datatype text,
>>
>>   name text,
>>
>>   *attributes* *map* < text, text >,
>>
>>   category text,
>>
>>   value text,
>>
>>   "timestamp" *timestamp*,
>>
>>   quality text
>>
>> );
>>
>>
>>
>> When I try to insert the data as JSON I got the error : *Error decoding
>> JSON value for value: Expected a UTF-8 string, but got a Double: 1.390692*.
>> The message is clear that a double value cannot be inserted to text column.
>> The real issue is that the value can be of any data type, so the schema
>> cannot be predefined. Is there a way to create a column which can hold
>> value of any data type. (I don’t want to hold the entire json as string. My
>> preferred way is to define a schema.)
>>
>>
>>
>> Regards,
>>
>> Rajeswari
>>
>>
>>
>>
>>
>> --
>>
>> Benjamin Roth
>> Prokurist
>>
>> Jaumo GmbH · www.jaumo.com
>> Wehrstraße 46 · 73035 Göppingen · Germany
>> Phone +49 7161 304880-6 <07161%203048806> · Fax +49 7161 304880-1
>> <07161%203048801>
>> AG Ulm · HRB 731058 · Managing Director: Jens Kammerer
>>
>


RE: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Benjamin Roth
Value is defined as text column and you try to insert a double. That's
simply not allowed

Am 01.02.2017 09:02 schrieb "Rajeswari Menon" :

> Given below is the sql query I executed.
>
>
>
> *insert* *into* data JSON'{
>
>   "id": 1,
>
>"address":"",
>
>"datatype":"DOUBLE",
>
>"name":"Longitude",
>
>"attributes":{
>
>   "ID":"1"
>
>},
>
>"category":"REAL",
>
>"value":1.390692,
>
>"timestamp":1485923271718,
>
>"quality":"GOOD"
>
> }';
>
>
>
> Regards,
>
> Rajeswari
>
>
>
> *From:* Benjamin Roth [mailto:benjamin.r...@jaumo.com]
> *Sent:* 01 February 2017 12:35
> *To:* user@cassandra.apache.org
> *Subject:* Re: Is it possible to have a column which can hold any data
> type (for inserting as json)
>
>
>
> You should post the whole CQL query you try to execute! Why don't you use
> a native JSON type for your JSON data?
>
>
>
> 2017-02-01 7:51 GMT+01:00 Rajeswari Menon :
>
> Hi,
>
>
>
> I have a json data as shown below.
>
>
>
> {
>
> "address":"127.0.0.1",
>
> "datatype":"DOUBLE",
>
> "name":"Longitude",
>
>  "attributes":{
>
> "Id":"1"
>
> },
>
> "category":"REAL",
>
> "value":1.390692,
>
> "timestamp":1485923271718,
>
> "quality":"GOOD"
>
> }
>
>
>
> To store the above json to Cassandra, I defined a table as shown below
>
>
>
> *create* *table* data
>
> (
>
>   id *int* *primary* *key*,
>
>   address text,
>
>   datatype text,
>
>   name text,
>
>   *attributes* *map* < text, text >,
>
>   category text,
>
>   value text,
>
>   "timestamp" *timestamp*,
>
>   quality text
>
> );
>
>
>
> When I try to insert the data as JSON I got the error : *Error decoding
> JSON value for value: Expected a UTF-8 string, but got a Double: 1.390692*.
> The message is clear that a double value cannot be inserted to text column.
> The real issue is that the value can be of any data type, so the schema
> cannot be predefined. Is there a way to create a column which can hold
> value of any data type. (I don’t want to hold the entire json as string. My
> preferred way is to define a schema.)
>
>
>
> Regards,
>
> Rajeswari
>
>
>
>
>
> --
>
> Benjamin Roth
> Prokurist
>
> Jaumo GmbH · www.jaumo.com
> Wehrstraße 46 · 73035 Göppingen · Germany
> Phone +49 7161 304880-6 <07161%203048806> · Fax +49 7161 304880-1
> <07161%203048801>
> AG Ulm · HRB 731058 · Managing Director: Jens Kammerer
>


RE: Is it possible to have a column which can hold any data type (for inserting as json)

2017-02-01 Thread Rajeswari Menon
Given below is the sql query I executed.

insert into data JSON'{
  "id": 1,
   "address":"",
   "datatype":"DOUBLE",
   "name":"Longitude",
   "attributes":{
  "ID":"1"
   },
   "category":"REAL",
   "value":1.390692,
   "timestamp":1485923271718,
   "quality":"GOOD"
}';

Regards,
Rajeswari

From: Benjamin Roth [mailto:benjamin.r...@jaumo.com]
Sent: 01 February 2017 12:35
To: user@cassandra.apache.org
Subject: Re: Is it possible to have a column which can hold any data type (for 
inserting as json)

You should post the whole CQL query you try to execute! Why don't you use a 
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon 
>:
Hi,

I have a json data as shown below.

{
"address":"127.0.0.1",
"datatype":"DOUBLE",
"name":"Longitude",
 "attributes":{
"Id":"1"
},
"category":"REAL",
"value":1.390692,
"timestamp":1485923271718,
"quality":"GOOD"
}

To store the above json to Cassandra, I defined a table as shown below

create table data
(
  id int primary key,
  address text,
  datatype text,
  name text,
  attributes map < text, text >,
  category text,
  value text,
  "timestamp" timestamp,
  quality text
);

When I try to insert the data as JSON I got the error : Error decoding JSON 
value for value: Expected a UTF-8 string, but got a Double: 1.390692. The 
message is clear that a double value cannot be inserted to text column. The 
real issue is that the value can be of any data type, so the schema cannot be 
predefined. Is there a way to create a column which can hold value of any data 
type. (I don’t want to hold the entire json as string. My preferred way is to 
define a schema.)

Regards,
Rajeswari



--
Benjamin Roth
Prokurist

Jaumo GmbH · www.jaumo.com
Wehrstraße 46 · 73035 Göppingen · Germany
Phone +49 7161 304880-6 · Fax +49 7161 304880-1
AG Ulm · HRB 731058 · Managing Director: Jens Kammerer


Re: Is it possible to have a column which can hold any data type (for inserting as json)

2017-01-31 Thread Benjamin Roth
You should post the whole CQL query you try to execute! Why don't you use a
native JSON type for your JSON data?

2017-02-01 7:51 GMT+01:00 Rajeswari Menon :

> Hi,
>
>
>
> I have a json data as shown below.
>
>
>
> {
>
> "address":"127.0.0.1",
>
> "datatype":"DOUBLE",
>
> "name":"Longitude",
>
>  "attributes":{
>
> "Id":"1"
>
> },
>
> "category":"REAL",
>
> "value":1.390692,
>
> "timestamp":1485923271718,
>
> "quality":"GOOD"
>
> }
>
>
>
> To store the above json to Cassandra, I defined a table as shown below
>
>
>
> *create* *table* data
>
> (
>
>   id *int* *primary* *key*,
>
>   address text,
>
>   datatype text,
>
>   name text,
>
>   *attributes* *map* < text, text >,
>
>   category text,
>
>   value text,
>
>   "timestamp" *timestamp*,
>
>   quality text
>
> );
>
>
>
> When I try to insert the data as JSON I got the error : *Error decoding
> JSON value for value: Expected a UTF-8 string, but got a Double: 1.390692*.
> The message is clear that a double value cannot be inserted to text column.
> The real issue is that the value can be of any data type, so the schema
> cannot be predefined. Is there a way to create a column which can hold
> value of any data type. (I don’t want to hold the entire json as string. My
> preferred way is to define a schema.)
>
>
>
> Regards,
>
> Rajeswari
>



-- 
Benjamin Roth
Prokurist

Jaumo GmbH · www.jaumo.com
Wehrstraße 46 · 73035 Göppingen · Germany
Phone +49 7161 304880-6 · Fax +49 7161 304880-1
AG Ulm · HRB 731058 · Managing Director: Jens Kammerer