1
votes

when I am trying to run "describe keyspace keyspacename" command using datastax driver 3.0, it gives me an error

Exception in thread "main" com.datastax.driver.core.exceptions.SyntaxError: line 1:0 no viable alternative at input 'DESCRIBE' ([DESCRIBE]...)

How to run "describe keyspace keyspacename" command?

2

2 Answers

7
votes

DESCRIBE is a cqlsh extension.

You could query system table like this

SELECT * from system.schema_keyspaces 
 WHERE keyspace_name = 'keyspacename';
1
votes

Datastax's Java Driver has a class KeyspaceMetadata which exposes the method exportAsString. So I used that method to get entire keyspace schema as string using this method.