Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-14942

cqlsh cannot describe keyspace when having table schema extensions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Low
    • Resolution: Unresolved
    • None
    • Tool/cqlsh
    • Cassandra 3.11.3

      The issue comes from the cqlsh utility, in cassandra/metadata.py, function _all_as_cql, viewkeys is not known. 

       

       

    • Low

    Description

      When adding a schema table extension to a table, cqlsh failed to describe keyspace or table with the following error message: 'module' object has no attribute 'viewkeys'

      Step to reproduce the issue:

      docker run --name some-cassandra -d docker.io/cassandra:3.11.3docker exec -it <container_id> cqlsh <<EOF

      CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};

      CREATE TABLE ks.cf (id text PRIMARY KEY , a int);

      INSERT INTO system_schema.tables (keyspace_name, table_name, extensions ) VALUES ( 'ks','cf',{'key1':textAsBlob('foo')});

      EOF

       

      docker exec -it <container_id> cqlsh -e "DESC KEYSPACE ks"

      'module' object has no attribute 'viewkeys'

       

      docker exec -it c75a002959e2 cqlsh --debug -e "DESC KEYSPACE ks"
      Using CQL driver: <module 'cassandra' from '/usr/share/cassandra/lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/_init_.py'>
      Using connect timeout: 5 seconds
      Using 'utf-8' encoding
      Using ssl: False

      Traceback (most recent call last):
      File "/usr/bin/cqlsh.py", line 925, in onecmd
      self.handle_statement(st, statementtext)
      File "/usr/bin/cqlsh.py", line 962, in handle_statement
      return custom_handler(parsed)
      File "/usr/bin/cqlsh.py", line 1545, in do_describe
      self.describe_keyspace(ksname)
      File "/usr/bin/cqlsh.py", line 1281, in describe_keyspace
      self.print_recreate_keyspace(self.get_keyspace_meta(ksname), sys.stdout)
      File "/usr/bin/cqlsh.py", line 1231, in print_recreate_keyspace
      out.write(ksdef.export_as_string())
      File "/usr/share/cassandra/lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/metadata.py", line 661, in export_as_string
      + [t.export_as_string() for t in self.tables.values()])
      File "/usr/share/cassandra/lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/metadata.py", line 1116, in export_as_string
      ret = self._all_as_cql()
      File "/usr/share/cassandra/lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/metadata.py", line 1135, in _all_as_cql
      for k in six.viewkeys(registry) & self.extensions: # no viewkeys on OrderedMapSerializeKey
      AttributeError: 'module' object has no attribute 'viewkeys'

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            vroyer59 vincent royer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: