You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2012/12/12 22:11:40 UTC
[2/2] git commit: cqlsh: add DESCRIBE KEYSPACES command;
patch by Aleksey Yeschenko, reviewed by Brandon Williams for
CASSANDRA-5060
cqlsh: add DESCRIBE KEYSPACES command;
patch by Aleksey Yeschenko, reviewed by Brandon Williams for
CASSANDRA-5060
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f562f0bb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f562f0bb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f562f0bb
Branch: refs/heads/cassandra-1.2
Commit: f562f0bb1f0a0b9bf6635948bfa11a1f7f4f12dd
Parents: fc5a0cc
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Thu Dec 13 00:07:26 2012 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Thu Dec 13 00:07:26 2012 +0300
----------------------------------------------------------------------
CHANGES.txt | 4 ++++
bin/cqlsh | 14 +++++++++++++-
2 files changed, 17 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f562f0bb/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 115ee45..d73849c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,7 @@
+1.2.0
+ * cqlsh: add DESCRIBE KEYSPACES command (CASSANDRA-5060)
+
+
1.2-rc1
* rename rpc_timeout settings to request_timeout (CASSANDRA-5027)
* add BF with 0.1 FP to LCS by default (CASSANDRA-5029)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f562f0bb/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 611f6af..f74dc42 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -211,7 +211,8 @@ cqlsh_extra_syntax_rules = r'''
;
<describeCommand> ::= ( "DESCRIBE" | "DESC" )
- ( "KEYSPACE" ksname=<keyspaceName>?
+ ( "KEYSPACES"
+ | "KEYSPACE" ksname=<keyspaceName>?
| ( "COLUMNFAMILY" | "TABLE" ) cf=<columnFamilyName>
| ( "COLUMNFAMILIES" | "TABLES" )
| "SCHEMA"
@@ -1328,6 +1329,11 @@ class Shell(cmd.Cmd):
out.write('CREATE INDEX %s ON %s (%s);\n'
% (col.index_name, cfname, self.cql_protect_name(col.name)))
+ def describe_keyspaces(self):
+ print
+ cmd.Cmd.columnize(self, self.get_keyspace_names())
+ print
+
def describe_keyspace(self, ksname):
print
self.print_recreate_keyspace(self.get_keyspace(ksname), sys.stdout)
@@ -1381,6 +1387,10 @@ class Shell(cmd.Cmd):
Outputs information about the connected Cassandra cluster, or about
the data stored on it. Use in one of the following ways:
+ DESCRIBE KEYSPACES
+
+ Output the names of all keyspaces.
+
DESCRIBE KEYSPACE [<keyspacename>]
Output CQL commands that could be used to recreate the given
@@ -1416,6 +1426,8 @@ class Shell(cmd.Cmd):
k.
"""
what = parsed.matched[1][1].lower()
+ if what == 'keyspaces':
+ self.describe_keyspaces()
if what == 'keyspace':
ksname = self.cql_unprotect_name(parsed.get_binding('ksname', ''))
if not ksname: