From 10372c20dfe5af0dc0ab7ed77370cd785c78e82e Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 26 Jul 2012 12:38:10 -0500 Subject: [PATCH] cqlsh: fix problem describing pre-cql3 CFs that are case-sensitive Patch by paul cannon reviewed by brandonwilliams for CASSANDRA-4385 --- bin/cqlsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/cqlsh b/bin/cqlsh index c67a818fd9..c4b35fc620 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -329,6 +329,9 @@ class NoKeyspaceError(Exception): class KeyspaceNotFound(Exception): pass +class ColumnFamilyNotFound(Exception): + pass + class VersionNotSupported(Exception): pass @@ -678,6 +681,8 @@ class Shell(cmd.Cmd): def fetchdict(self): row = self.cursor.fetchone() + if row is None: + return None desc = self.cursor.description return dict(zip([d[0] for d in desc], row)) @@ -705,7 +710,7 @@ class Shell(cmd.Cmd): for c in cf_defs: if c.name == cfname: return c - raise KeyError("Unconfigured column family %r" % (cfname,)) + raise ColumnFamilyNotFound("Unconfigured column family %r" % (cfname,)) def get_columnfamily_names(self, ksname=None): return [c.name for c in self.get_columnfamilies(ksname)] @@ -800,6 +805,8 @@ class Shell(cmd.Cmd): where "keyspace"=:ks and "columnfamily"=:cf""", {'ks': ksname, 'cf': cfname}) layout = self.fetchdict() + if layout is None: + raise ColumnFamilyNotFound("Column family %r not found" % cfname) self.cursor.execute("""select * from system.schema_columns where "keyspace"=:ks and "columnfamily"=:cf""", {'ks': ksname, 'cf': cfname})