[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 <rajeswari.m@xxxxxxxxxxxxx>:



                I have a json data as shown below.















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.)




Benjamin Roth

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