cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <aeljami....@orange.com>
Subject RE: Migration from 2.0.10 to 2.1.12
Date Wed, 30 Mar 2016 14:10:12 GMT
full is a reserved word in apache Cassandra / cql 3.1

https://cassandra.apache.org/doc/cql3/CQL.html#appendixA

*Reserved keywords cannot be used as identifier , they are truly reserved for the language
(but one can enclose a reserved keyword by double-quotes to use it as an identifier)

De : Jean Carlo [mailto:jean.jeancarl48@gmail.com]
Envoyé : mercredi 30 mars 2016 16:08
À : user@cassandra.apache.org
Objet : Re: Migration from 2.0.10 to 2.1.12

@Laing thx for the info.
@Carlos I also check that page and I did not find it. I was asking to know if someone has
done smth to avoid change the column name everytime cassandra adds new words to the list.



Saludos

Jean Carlo

"The best way to predict the future is to invent it" Alan Kay

On Wed, Mar 30, 2016 at 4:02 PM, Carlos Alonso <info@mrcalonso.com<mailto:info@mrcalonso.com>>
wrote:
Well...

I guess that if full is a reserved word there's nothing you can do to change that but then,
checking which are the keywords for that version it turns out that full is not there!!
https://docs.datastax.com/en/cql/3.1/cql/cql_reference/keywords_r.html

Maybe a bug?

Regards

Carlos Alonso | Software Engineer | @calonso<https://twitter.com/calonso>

On 30 March 2016 at 15:41, Jean Carlo <jean.jeancarl48@gmail.com<mailto:jean.jeancarl48@gmail.com>>
wrote:
Yes we did some reads and writes, the problem is that adding double quotes force us to modify
our code to change and insert like that

INSERT INTO table1 (bill_id, full, name,provider_date ,total) values ('qs','full','name','2015-02-23','toltal');
to this

INSERT INTO table1 (bill_id, "full", name,provider_date ,total) values ('qs','full','name','2015-02-23','toltal');
this last one is ok, but obviously the first one makes an error:

cqlsh:pns_fr_2_jean> INSERT INTO table1 (bill_id, full, name,provider_date ,total) values
('qs','full','name','2015-02-23','toltal');
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:29
no viable alternative at input 'full' (INSERT INTO table1 (bill_id, [full]...)">
and it is because the name of the column is not longer full, is "full"


Best regards

Jean Carlo

"The best way to predict the future is to invent it" Alan Kay

On Wed, Mar 30, 2016 at 3:26 PM, Eric Evans <eevans@wikimedia.org<mailto:eevans@wikimedia.org>>
wrote:
On Wed, Mar 30, 2016 at 8:08 AM, Jean Carlo <jean.jeancarl48@gmail.com<mailto:jean.jeancarl48@gmail.com>>
wrote:
> With double quotes it doesn't show error
>
> CREATE TABLE table1 (     bill_id text,     "full" text,     name text,
> provider_date timestamp,     total text,     PRIMARY KEY ( bill_id) ) ;
>
> but it changes the name of the column

I don't think it does though; You're meant to be able to use the
output of DESC TABLE to (re)create these tables, so it's quoted below
for the same reason you did so above.

Obviously it would be better to have column names that parse without
needing to be double quoted, but it should work.  Have you tried some
reads and writes?

> desc table table1;
>
> CREATE TABLE pns_fr_2_jean.table1 (
>     bill_id text PRIMARY KEY,
>     "full" text,
>     name text,
>     provider_date timestamp,
>     total text
> )
>
> instead of
>
> CREATE TABLE pns_fr_2_jean.table1 (
>     bill_id text PRIMARY KEY,
>     full text,
>     name text,
>     provider_date timestamp,
>     total text
> )

--
Eric Evans
eevans@wikimedia.org<mailto:eevans@wikimedia.org>




_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees
et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par
erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant
susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may
be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message
and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed
or falsified.
Thank you.

Mime
View raw message