Avoid potential AttributeError in cqlsh due to no table metadata

Patch by Stefania Alborghetti; reviewed by Robert Stupp for CASSANDRA-12815
This commit is contained in:
Stefania Alborghetti 2016-10-20 10:06:50 +08:00
parent 3cb023355a
commit 13b7362494
2 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,5 @@
3.10
* Avoid potential AttributeError in cqlsh due to no table metadata (CASSANDRA-12815)
* Fix RandomReplicationAwareTokenAllocatorTest.testExistingCluster (CASSANDRA-12812)
* Upgrade commons-codec to 1.9 (CASSANDRA-12790)
* Make the fanout size for LeveledCompactionStrategy to be configurable (CASSANDRA-11550)

View File

@ -1334,7 +1334,8 @@ class Shell(cmd.Cmd):
cql_types = []
if result.column_types:
ks_meta = self.conn.metadata.keyspaces[table_meta.keyspace_name]
ks_name = table_meta.keyspace_name if table_meta else self.current_keyspace
ks_meta = self.conn.metadata.keyspaces.get(ks_name, None)
cql_types = [CqlType(cql_typename(t), ks_meta) for t in result.column_types]
formatted_values = [map(self.myformat_value, row.values(), cql_types) for row in result.current_rows]