You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Tyler Patterson (JIRA)" <ji...@apache.org> on 2012/08/30 23:36:08 UTC

[jira] [Commented] (CASSANDRA-4592) CQL COPY TO command doesn't work with python cassandra-dbapi2

    [ https://issues.apache.org/jira/browse/CASSANDRA-4592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13445319#comment-13445319 ] 

Tyler Patterson commented on CASSANDRA-4592:
--------------------------------------------

doh!
                
> CQL COPY TO command doesn't work with python cassandra-dbapi2
> -------------------------------------------------------------
>
>                 Key: CASSANDRA-4592
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4592
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: ubuntu, dtest, ccm cluster, cassandra 1.1.4
>            Reporter: Tyler Patterson
>
> Running the COPY TO command produces the below error, though running the same COPY TO command in cqlsh in the exact same cluster works fine:
> {code}
> ======================================================================
> ERROR: copyto_test.TestCopyTo.copy_to_test
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
>     self.test(*self.arg)
>   File "/home/tahooie/datastax/cassandra-dtest/tools.py", line 132, in wrapped
>     f(obj)
>   File "/home/tahooie/datastax/cassandra-dtest/copyto_test.py", line 33, in copy_to_test
>     cursor_v2.execute(copy_from_cql)
>   File "/usr/local/lib/python2.7/dist-packages/cql/cursor.py", line 117, in execute
>     response = self.handle_cql_execution_errors(doquery, prepared_q, compress)
>   File "/usr/local/lib/python2.7/dist-packages/cql/cursor.py", line 134, in handle_cql_execution_errors
>     raise cql.ProgrammingError("Bad Request: %s" % ire.why)
> ProgrammingError: Bad Request: line 1:0 no viable alternative at input 'COPY'
> ----------------------------------------------------------------------
> Ran 1 test in 8.239s
> {code}
> Here is an example of the COPY TO command: 
> {code}
> COPY airplanes TO '/tmp/tmpOCdbFt';
> {code}
> This is the dtest used to produce the error:
> {code}
> import os
> import tempfile
> from dtest import Tester, debug
> from tools import *
> class TestCopyTo(Tester):
>     
>     @since('1.1')
>     def copy_to_test(self):
>         self.num_rows = 0
>         cluster = self.cluster
>         cluster.populate(2).start()
>         time.sleep(1)
>         node1 = cluster.nodelist()[0]
>         cursor_v2 = self.cql_connection(node1).cursor()
>         self.create_ks(cursor_v2, 'ks', 2)
>         cursor_v2.execute("""
>             CREATE TABLE airplanes (
>                 name text PRIMARY KEY,
>                 manufacturer ascii,
>                 year int,
>                 mach float
>                 );
>             """)
>         cursor_v2.execute("INSERT INTO airplanes (name, manufacturer, year, mach) VALUES ('P38-Lightning', 'Lockheed', 1937, '.7')")
>         fn = tempfile.NamedTemporaryFile().name
>         copy_from_cql = "COPY airplanes TO '%s'" % fn
>         cursor_v2.execute(copy_from_cql)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira