Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B9DEC18366 for ; Fri, 13 Nov 2015 12:20:34 +0000 (UTC) Received: (qmail 30176 invoked by uid 500); 13 Nov 2015 12:20:31 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 30133 invoked by uid 500); 13 Nov 2015 12:20:31 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 30123 invoked by uid 99); 13 Nov 2015 12:20:31 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Nov 2015 12:20:31 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 39D961A41C4 for ; Fri, 13 Nov 2015 12:20:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3 X-Spam-Level: *** X-Spam-Status: No, score=3 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, SPF_HELO_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id cMIFvC0kuSRH for ; Fri, 13 Nov 2015 12:20:17 +0000 (UTC) Received: from mail1.bemta5.messagelabs.com (mail1.bemta5.messagelabs.com [195.245.231.140]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id A23E720CF5 for ; Fri, 13 Nov 2015 12:20:16 +0000 (UTC) Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 1D/CF-24856-975D5465; Fri, 13 Nov 2015 12:20:09 +0000 X-Env-Sender: Rajesh.Radhakrishnan@phe.gov.uk X-Msg-Ref: server-8.tower-206.messagelabs.com!1447417208!3472728!1 X-Originating-IP: [194.74.226.168] X-StarScan-Received: X-StarScan-Version: 7.19.2; banners=phe.gov.uk,-,- X-VirusChecked: Checked Received: (qmail 8887 invoked from network); 13 Nov 2015 12:20:08 -0000 Received: from mail3.hpa.org.uk (HELO MAILHUBCOL01.phe.gov.uk) (194.74.226.168) by server-8.tower-206.messagelabs.com with AES128-SHA encrypted SMTP; 13 Nov 2015 12:20:08 -0000 Received: from MAILMBXCOL02.phe.gov.uk ([fe80::6548:b64d:8c88:3685]) by MAILHUBCOL01.phe.gov.uk ([fe80::41cb:80da:36e2:5a32%14]) with mapi id 14.03.0158.001; Fri, 13 Nov 2015 12:20:08 +0000 From: Rajesh Radhakrishnan To: "user@cassandra.apache.org" Subject: RE: Getting code=2200 [Invalid query] message=Invalid column name ... while executing ALTER statement Thread-Topic: Getting code=2200 [Invalid query] message=Invalid column name ... while executing ALTER statement Thread-Index: AQHRHgMVj6Cd/70qeUCeSj+no51ciJ6Z2DsAgAAFav8= Date: Fri, 13 Nov 2015 12:20:07 +0000 Message-ID: <0A9C05DECDEB6A4FAF7A3783EECB78002518CAB0@MAILMBXCOL02.phe.gov.uk> References: <0A9C05DECDEB6A4FAF7A3783EECB78002518CA39@MAILMBXCOL02.phe.gov.uk>, In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [2002:9e77:4119::9e77:4119] Content-Type: multipart/alternative; boundary="_000_0A9C05DECDEB6A4FAF7A3783EECB78002518CAB0MAILMBXCOL02phe_" MIME-Version: 1.0 --_000_0A9C05DECDEB6A4FAF7A3783EECB78002518CAB0MAILMBXCOL02phe_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thank you Carlos for looking. But when I rand the nodetool describecluster. It is showing the same schema versions for both nodes? So it is something else! Please help me from this bottleneck. Thank you. ________________________________ From: Carlos Alonso [info@mrcalonso.com] Sent: 13 November 2015 11:55 To: user@cassandra.apache.org Subject: Re: Getting code=3D2200 [Invalid query] message=3DInvalid column = name ... while executing ALTER statement Maybe schema disagreement? Run nodetool describecluster to discover Carlos Alonso | Software Engineer | @calonso On 13 November 2015 at 11:14, Rajesh Radhakrishnan > wrote: Hi, I am using Cassandra 2.1.5 in a cluster of two nodes (running CentOS) and = using Python driver to connect to Cassandra. My Python code snippet is show here: #-------------------------------------------------------------------------= ------------------------------------------ import time, os, datetime, keyword import uuid from cassandra.cluster import Cluster import os.path, sys .... from cassandra.auth import PlainTextAuthProvider .... auth_provider =3D PlainTextAuthProvider(username, password) cluster =3D Cluster([node1,node2],auth_provider=3Dauth_provider) session =3D cluster.connect(); session.execute("CREATE table IF NOT EXISTS test.iau (" "id uuid, " "sample_id text, " "PRIMARY KEY (sample_id) )"); print " \n created the table" #-------- sqlInsertSampleIdUid =3D "INSERT INTO test.iau (id, sample_id) VAL= UES ("+str(uuid.uuid1())+",'sample123')" session.execute(sqlInsertSampleIdUid) print " \n Inserted main ids into the table" #------- colNames =3D['col1','col2','col3','col4','col5','col6','col7','col= 8','col9'] for colName in colNames : sqlAlterStatement1 =3D " ALTER TABLE test.iau ADD "+colName+" = text" print sqlAlterStatement1 session.execute(sqlAlterStatement1) sqlAlterStatement1 =3D None print " Altered tables :: " # ---------------------------------------- count =3D 0 for colName in colNames : count =3D count +1 sqlUpdateGeneDetection =3D " UPDATE test.iau SET "+colName+" =3D= '"+str(count)+"' WHERE sample_id =3D 'sample123'" session.execute(sqlUpdateGeneDetection) sqlUpdateGeneDetection =3D None print " Updated tables :: " session.cluster.shutdown() .... #-------------------------------------------------------------------------= ------------------------------------------ Very rarely this code works, but most of the time it fails when it reach A= LTER statement. FYI, I tried preparedstatement with binding in INSERT, UPDATE statements t= oo. The error with output is shown here: #------ created the table Inserted main ids into the table ALTER TABLE test.iau ADD col1 text ALTER TABLE test.iau ADD col2 text ALTER TABLE test.iau ADD col3 text ALTER TABLE test.iau ADD col4 text ALTER TABLE test.iau ADD col5 text ALTER TABLE test.iau ADD col6 text ALTER TABLE test.iau ADD col7 text ALTER TABLE test.iau ADD col8 text ALTER TABLE test.iau ADD col9 text E =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ---------------------------------------------------------------------- Traceback (most recent call last): File "UnitTests.py", line 313, in test_insert_data session.execute(sqlAlterStatement1) File "/usr/local/lib/python2.7/site-packages/cassandra/cluster.py", line= 1405, in execute result =3D future.result(timeout) File "/usr/local/lib/python2.7/site-packages/cassandra/cluster.py", line= 2976, in result raise self._final_exception InvalidRequest: code=3D2200 [Invalid query] message=3D"Invalid column name= col9 because it conflicts with an existing column" ---------------------------------------------------------------------- Ran 1 test in 9.856s #------ But when I checked the table using CQL col9 is not there. Is there' schema' refresh issue or is it bug in Cassandra 2.1.5? Thank you. Kind regards Rajesh R **************************************************************************= The information contained in the EMail and any attachments is confidential= and intended solely and for the attention and use of the named addressee(= s). It may not be disclosed to any other person without the express author= ity of Public Health England, or the intended recipient, or both. If you a= re not the intended recipient, you must not disclose, copy, distribute or = retain this message or any part of it. This footnote also confirms that th= is EMail has been swept for computer viruses by Symantec.Cloud, but please= re-sweep any attachments before opening or saving. http://www.gov.uk/PHE **************************************************************************= **************************************************************************= The information contained in the EMail and any attachments is confidential= and intended solely and for the attention and use of the named addressee(= s). It may not be disclosed to any other person without the express author= ity of Public Health England, or the intended recipient, or both. If you a= re not the intended recipient, you must not disclose, copy, distribute or = retain this message or any part of it. This footnote also confirms that th= is EMail has been swept for computer viruses by Symantec.Cloud, but please= re-sweep any attachments before opening or saving. http://www.gov.uk/PHE **************************************************************************= --_000_0A9C05DECDEB6A4FAF7A3783EECB78002518CAB0MAILMBXCOL02phe_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Thank you Carlos f= or looking.
But when I rand the
nodetool describecluster.
It is showing the same schema versions for both nodes?

So it is something else! Please help me from this bottleneck. Thank you.

From: Carlos Alonso [info@mrcalonso.com= ]
Sent: 13 November 2015 11:55
To: user@cassandra.apache.org
Subject: Re: Getting code=3D2200 [Invalid query] message=3DInvalid = column name ... while executing ALTER statement

Maybe schema disagreement? 

Run nodetool describecluster to discover

Carlos Alons= o | Software Engineer | @calonso

On 13 November 2015 at 11:14, Rajesh Radhakrish= nan <R= ajesh.Radhakrishnan@phe.gov.uk> wrote:

Hi,

I am using Cassandra 2.1.5 in a cluster of two nodes (running CentOS) and = using Python driver=20to connect to Cassandra.
My Python code snippet is show here:

#-------------------------------------------------------------------------= ------------------------------------------
import time, os, datetime, keyword
import uuid
from cassandra.cluster import Cluster
import os.path, sys
....
from cassandra.auth import PlainTextAuthProvider
....
       auth_provider =3D PlainTextAuthProvid= er(username, password)
       cluster =3D Cluster([node1,node2],auth_pro= vider=3Dauth_provider)
       session =3D cluster.connect();
            &n= bsp;
        session.execute("CREATE ta= ble IF NOT EXISTS test.iau ("
            &n= bsp;       "id uuid, "
            &n= bsp;       "sample_id text, "
=             &n= bsp;       "PRIMARY KEY (sample_id) )&q= uot;);
            &n= bsp;      
        print " \n created the tab= le"
        #--------
       
        sqlInsertSampleIdUid =3D "= INSERT INTO test.iau (id, sample_id) VALUES ("+str(uuid.uuid1())&= #43;",'sample123')"
        session.execute(sqlInsertSample= IdUid)
        print " \n Inserted main i= ds into the table"
        #-------

        colNames =3D['col1','col2','col= 3','col4','col5','col6','col7','col8','col9']
       
        for colName in colNames :
           
            sqlAlte= rStatement1 =3D " ALTER TABLE test.iau ADD "+colName+&qu= ot; text"
            print s= qlAlterStatement1
            session= .execute(sqlAlterStatement1)
            sqlAlte= rStatement1 =3D None
       
        print " Altered tables :: = "
        # -----------------------------= -----------
        count =3D 0
        for colName in colNames :
            count =3D= count +1
            sqlUpda= teGeneDetection =3D " UPDATE test.iau SET "+colName+&quo= t; =3D '"+str(count)+"' WHERE sample_id =3D 'sample123'&= quot;
            session= .execute(sqlUpdateGeneDetection)
            sqlUpda= teGeneDetection =3D None

        print " Updated tables :: = "
        session.cluster.shutdown()
....
#-------------------------------------------------------------------------= ------------------------------------------
       
Very rarely this code works, but most of the time it fails when it reach A= LTER statement.
FYI, I tried preparedstatement with binding in INSERT, UPDATE statements t= oo.

The error with output is shown here:

#------
created the table
 
 Inserted main ids into the table
 ALTER TABLE test.iau ADD col1 text
 ALTER TABLE test.iau ADD col2 text
 ALTER TABLE test.iau ADD col3 text
 ALTER TABLE test.iau ADD col4 text
 ALTER TABLE test.iau ADD col5 text
 ALTER TABLE test.iau ADD col6 text
 ALTER TABLE test.iau ADD col7 text
 ALTER TABLE test.iau ADD col8 text
 ALTER TABLE test.iau ADD col9 text
E
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

----------------------------------------------------------------------
= Traceback (most recent call last):
  File "UnitTests.py", line 313, in test_insert_data
    session.execute(sqlAlterStatement1)
  File "/usr/local/lib/python2.7/site-packages/cassandra/cluster= .py", line 1405, in execute
    result =3D future.result(timeout)
  File "/usr/local/lib/python2.7/site-packages/cassandra/cluster= .py", line 2976, in result
    raise self._final_exception
InvalidRequest: code=3D2200 [Invalid query] message=3D"Invalid column= name col9 because it conflicts with an existing column"

----------------------------------------------------------------------
= Ran 1 test in 9.856s
#------

But when I checked the table using CQL col9 is not there.

Is there' schema' refresh issue or is it bug in Cassandra 2.1.5?

Thank you.
Kind regards
Rajesh R



**************************************************************************=
The information contained in the EMail and any attachments is confidential= and intended solely and for the attention and use of the named addressee(= s). It=20may not be disclosed to any other person without the express auth= ority of Public Health England, or the intended recipient, or both. If you are not the intended recipient, you m= ust not disclose, copy, distribute or retain this message or any part of i= t. This footnote also confirms that this EMail has been swept for computer= viruses by Symantec.Cloud, but please re-sweep any attachments before opening or saving. http://www.gov.uk/PHE
**************************************************************************=


**************************************************************************=
The information contained in the EMail and any attachments is confidential= and intended solely and for the attention and use of the named addressee(= s). It may not be disclosed to any other person without the express author= ity of Public Health England, or the intended recipient, or both. If you a= re not the intended recipient, you must not disclose, copy, distribute or = retain this message or any part of it. This footnote also confirms that th= is EMail has been swept for computer viruses by Symantec.Cloud, but please= re-sweep any attachments before opening or saving. http://www.gov.uk/PHE<= BR> **************************************************************************=
--_000_0A9C05DECDEB6A4FAF7A3783EECB78002518CAB0MAILMBXCOL02phe_--