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 4F03918184 for ; Fri, 13 Nov 2015 11:16:01 +0000 (UTC) Received: (qmail 16544 invoked by uid 500); 13 Nov 2015 11:15:58 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 16503 invoked by uid 500); 13 Nov 2015 11:15:58 -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 16493 invoked by uid 99); 13 Nov 2015 11:15:58 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Nov 2015 11:15:58 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 230FDC0052 for ; Fri, 13 Nov 2015 11:15:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.999 X-Spam-Level: ** X-Spam-Status: No, score=2.999 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id kjg6VGgXaouh for ; Fri, 13 Nov 2015 11:15:44 +0000 (UTC) Received: from mail1.bemta5.messagelabs.com (mail1.bemta5.messagelabs.com [195.245.231.145]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id E41AD42B20 for ; Fri, 13 Nov 2015 11:15:43 +0000 (UTC) Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 72/EB-30270-556C5465; Fri, 13 Nov 2015 11:15:33 +0000 X-Env-Sender: Rajesh.Radhakrishnan@phe.gov.uk X-Msg-Ref: server-16.tower-206.messagelabs.com!1447413326!3436212!7 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 28271 invoked from network); 13 Nov 2015 11:15:32 -0000 Received: from mail3.hpa.org.uk (HELO MAILHUBCOL02.phe.gov.uk) (194.74.226.168) by server-16.tower-206.messagelabs.com with AES128-SHA encrypted SMTP; 13 Nov 2015 11:15:32 -0000 Received: from MAILHUBCOL04.phe.gov.uk (2002:9e77:4224::9e77:4224) by MAILHUBCOL02.phe.gov.uk (2002:9e77:4236::9e77:4236) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 13 Nov 2015 11:14:05 +0000 Received: from MAILMBXCOL02.phe.gov.uk ([fe80::6548:b64d:8c88:3685]) by MAILHUBCOL04.phe.gov.uk ([fe80::e541:764:ef33:fe07%12]) with mapi id 14.03.0158.001; Fri, 13 Nov 2015 11:14:05 +0000 From: Rajesh Radhakrishnan To: "user@cassandra.apache.org" Subject: 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+no51ciA== Date: Fri, 13 Nov 2015 11:14:05 +0000 Message-ID: <0A9C05DECDEB6A4FAF7A3783EECB78002518CA39@MAILMBXCOL02.phe.gov.uk> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [2002:9e77:4116::9e77:4116] Content-Type: multipart/alternative; boundary="_000_0A9C05DECDEB6A4FAF7A3783EECB78002518CA39MAILMBXCOL02phe_" MIME-Version: 1.0 --_000_0A9C05DECDEB6A4FAF7A3783EECB78002518CA39MAILMBXCOL02phe_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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) =20 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 **************************************************************************= --_000_0A9C05DECDEB6A4FAF7A3783EECB78002518CA39MAILMBXCOL02phe_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

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 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 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_0A9C05DECDEB6A4FAF7A3783EECB78002518CA39MAILMBXCOL02phe_--