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

SOURCE command in CQLSH 3.2 requires that "use keyspace" is in the cql file that you are sourcing

    XMLWordPrintableJSON

    Details

    • Severity:
      Normal

      Description

      a difference in behaviour between SOURCE command in CQLSH 3.1 and 3.2.
      In CQLSH 3.1 SOURCE will NOT require "use keyspace" in the cql file that you execute: the "keyspace" directive in the qlshrc file will work and the cql file will be executed.

      In CQLSH 3.2.1, SOURCE command requires that "use keyspace" is in the cql file that you are sourcing, otherwise it throws this error:
      "No keyspace has been specified. USE a keyspace, or explicitly specify keyspace.tablename".
      The "keyspace" directive in cqlshrc is overridden by source command.

      steps to reproduce:
      create a file called select.cql in your home directory:

      echo "CONSISTENCY ONE;" > select.cql
      echo "select * from tab;" >> select.cql
      

      in cqlsh:

      create KEYSPACE kspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
      create TABLE tab ( id int primary key);
      insert into tab (id) VALUES ( 1);
      

      Add this to cqlsgrc:

      [authentication]
      keyspace = kspace
      

      Then exit cqlsh and rerun cqlsh using the cqlshrc just modified.
      Note that you are in keyspace "kspace".
      execute:

      source 'select.cql' 
      

      this will have different behaviour in CQLSH 3.2 and 3.1

        Attachments

          Activity

            People

            • Assignee:
              stefania Stefania Alborghetti
              Reporter:
              fanimali Francesco Animali
              Authors:
              Stefania Alborghetti
              Reviewers:
              Robert Stupp
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: