Run cqlsh commands from Java client

2,048 views
Skip to first unread message

Soumik Biswas

unread,
Apr 30, 2014, 4:37:26 PM4/30/14
to java-dri...@lists.datastax.com

Hi,
 Is it possible to run the cqlsh commands from Java Driver??
I'm trying to run the COPY command from the Java client and its throwing errors as :

Error: com.datastax.driver.core.exceptions.SyntaxError: line 1:0 no viable alternative at input 'COPY'
com.datastax.driver.core.exceptions.SyntaxError: line 1:0 no viable alternative at input 'COPY'

I'm running Cassandra 2.0.4 with Java Client  version 2.0.1

Thanks/

Alex Popescu

unread,
Apr 30, 2014, 4:43:06 PM4/30/14
to java-dri...@lists.datastax.com
There are a couple of commands in cqlsh that are not actually part of the CQL spec (e.g. DESCRIBE, COPY, see complete list at the end) and these are not
supported in the Java driver. At some point we will probably add some utility modules to cover such scenarios. If you want you could open
a JIRA ticket (in which it would be useful if you could describe the scenario) https://datastax-oss.atlassian.net/browse/JAVA so we can track this request.

thanks


cqlsh specific commands: CAPTURE, COPY, DESCRIBE, EXPAND, SHOW, TRACING, CONSISTENCY, DESC


To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.



--

:- a)


Alex Popescu
Sen. Product Manager @ DataStax
@al3xandru

Scott Lewis

unread,
Dec 30, 2014, 3:10:21 PM12/30/14
to java-dri...@lists.datastax.com
I went to the bug tracking at https://datastax-oss.atlassian.net/browse/JAVA and could not find any bugs/enhancements added to support COPY specifically or any of the other currently cqlsh-specific commands.   Should I open an enhancement request for COPY support specifically?  My use case is desire to use COPY in java driver to read/import csv.

Thanks,

Scott

Olivier Michallat

unread,
Jan 5, 2015, 9:29:09 AM1/5/15
to java-dri...@lists.datastax.com
Hi,

JAVA-330 was created after this conversation. 

--

Olivier Michallat

Driver & tools engineer, DataStax

Message has been deleted

manish jain

unread,
Mar 11, 2015, 11:00:27 AM3/11/15
to java-dri...@lists.datastax.com
Hello Soumik,

I am facing the same issue with the COPY command in cassandra. 
Did you find any solution for it yet ?

I also tried with by creating a cql script with my Copy command in it and then running source ' *.cql ' from my Java driver. 
Faced the same issue "com.datastax.driver.core.exceptions.SyntaxError: line 1:0 no viable alternative at input 'Source"
May be 'source' is also not included in the CQL spec.

Please share the solution if u found already :)
Thanks in advance. 

 

Michael Dykman

unread,
Mar 11, 2015, 12:05:49 PM3/11/15
to java-dri...@lists.datastax.com
JAVA-330 tells us that COPY and presumable SOURCE are not likely to appear at all in the core driver as they are not part of the core functionality of the driver.  cqlsh itself implements those routines in python.
   

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.



--
 - michael dykman
 - mdy...@gmail.com

 May the Source be with you.

Scott Lewis

unread,
Mar 11, 2015, 2:38:50 PM3/11/15
to java-dri...@lists.datastax.com
On 3/11/2015 9:05 AM, Michael Dykman wrote:
JAVA-330 tells us that COPY and presumable SOURCE are not likely to appear at all in the core driver as they are not part of the core functionality of the driver.  cqlsh itself implements those routines in python.

Although admittedly not part of the driver core functionality, it would be nice if this was supported...perhaps in com.datastax.driver.core.utils, or some other/new package.

If a code contribution is desired, I would be willing to contribute.

Scott

Alex Popescu

unread,
Mar 11, 2015, 4:02:38 PM3/11/15
to java-dri...@lists.datastax.com

On Wed, Mar 11, 2015 at 11:38 AM, Scott Lewis <scott...@gmail.com> wrote:
If a code contribution is desired, I would be willing to contribute.

That would be great and more than welcome! Do you have a proposed API in mind? I'd like us to discuss this first to optimize the process.


--

[:>-a)

David Ing

unread,
Mar 9, 2016, 5:38:05 PM3/9/16
to DataStax Java Driver for Apache Cassandra User Mailing List
So far the ticket is just being ignored.


Does anybody know of another driver that we can use to execute the DESCRIBE command?

Alex Popescu

unread,
Mar 9, 2016, 6:51:30 PM3/9/16
to java-dri...@lists.datastax.com
Hi David,

The ticket you are mentioning hasn’t been ignored. Since that ticket was opened, the `COPY` command in cqlsh has seen big improvements. On the drivers side we’ve been looking at providing some ways for manipulating data in bulk, but so far other priorities came first.

Could you expand a bit on what you’d need a `describe` function in the driver for? As you probably know already, there is complete support for keyspace/table/column metadata in the driver.

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.

To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.



--
Bests,

Alex Popescu | @al3xandru

David Ing

unread,
Mar 9, 2016, 6:56:34 PM3/9/16
to java-dri...@lists.datastax.com
I am just starting to use the Datastax java driver for Cassandra, so I don't know everything yet.

I wanted to execute these commands:

describe keyspaces
describe keyspace [keyspace_name]

I would like to hear about any alternatives that you know about.

David Ing

unread,
Mar 9, 2016, 8:49:45 PM3/9/16
to java-dri...@lists.datastax.com
I found it.

    com.datastax.driver.core.Cluster#getMetadata

Thanks for the hint.
Reply all
Reply to author
Forward
0 new messages