cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zach Kurey <zach.ku...@datastax.com>
Subject Re: JSON Cassandra 2.2 - insert syntax
Date Tue, 02 Jun 2015 01:12:08 GMT
Looks like you have your use of single vs. double quotes inverted.  What
you want is:

INSERT INTO users JSON  '{"id": 123,"name": "jbellis","address": {"home": {
"street": "123 Cassandra Dr","city": "Austin","zip_code": 78747,"phones": [
2101234567]}}}';

HTH

On Mon, Jun 1, 2015 at 6:03 PM, Michel Blase <mblase23@gmail.com> wrote:

> Hi all,
>
> I'm trying to test the new JSON functionalities in C* 2.2.
>
> I'm using this example:
>
> https://issues.apache.org/jira/browse/CASSANDRA-7970
>
> I believe there is a typo in the CREATE TABLE statement that requires
> frozen:
>
> CREATE TABLE users (id int PRIMARY KEY,name text,addresses map<text,
> frozen<address>>);
>
> but my real problem is in the insert syntax. I've found the CQL-2.2
> documentation and my best guess is this:
>
> INSERT INTO users JSON "{'id': 123,'name': 'jbellis','address': {'home':
> {'street': '123 Cassandra Dr','city': 'Austin','zip_code': 78747,'phones':
> [2101234567]}}}";
>
> but I get the error:
>
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query]
> message="line 1:23 mismatched input '{'id': 123,'name':
> 'jbellis','address': {'home': {'street': '123 Cassandra Dr','city':
> 'Austin','zip_code': 78747,'phones': [2101234567]}}}' expecting ')' (INSERT
> INTO users JSON ["{'id': 123,'name': 'jbellis','address': {'home':
> {'street': '123 Cassandra Dr','city': 'Austin','zip_code': 78747,'phones':
> [2101234567]}}]}";)">
>
>
> Any idea?
>
>
> Thanks,
>
> Michael
>
>
>

Mime
View raw message