[ 
https://issues.apache.org/jira/browse/CASSANDRA-11152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15307873#comment-15307873
 ] 

Stefania commented on CASSANDRA-11152:
--------------------------------------

You're correct [~snazy], adding the keyspace parameter to the Shell constructor 
invocation in {{do_source}} fixes it. In fact, I don't see why we shouldn't 
pass {{self.current_keyspace}} so that we pick up the current keyspace that has 
been set by a USE directive, not just the one specified in cqlshrc. Are you 
happy to review or shall I ask someone else for confirmation of this behavior?

Patch and cqlsh dtests (still running):

||2.1||2.2||3.0||3.7||trunk||
|[patch|https://github.com/stef1927/cassandra/commits/11152-cqlsh-2.1]|[patch|https://github.com/stef1927/cassandra/commits/11152-cqlsh-2.2]|[patch|https://github.com/stef1927/cassandra/commits/11152-cqlsh-3.0]|[patch|https://github.com/stef1927/cassandra/commits/11152-cqlsh-3.7]|[patch|https://github.com/stef1927/cassandra/commits/11152-cqlsh]|
|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-11152-cqlsh-2.1-cqlsh-tests/]|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-11152-cqlsh-2.2-cqlsh-tests/]|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-11152-cqlsh-3.0-cqlsh-tests/]|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-11152-cqlsh-3.7-cqlsh-tests/]|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-11152-cqlsh-cqlsh-tests/]|


> SOURCE command in CQLSH 3.2 requires that "use keyspace" is in the cql file 
> that you are sourcing
> -------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-11152
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11152
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>         Environment: CQLSH 3.2.1
>            Reporter: Francesco Animali
>            Assignee: Stefania
>
> 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:
> {noformat}
> echo "CONSISTENCY ONE;" > select.cql
> echo "select * from tab;" >> select.cql
> {noformat}
> in cqlsh:
> {noformat}
> create KEYSPACE kspace WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};
> create TABLE tab ( id int primary key);
> insert into tab (id) VALUES ( 1);
> {noformat}
> Add this to cqlsgrc:
> {noformat}
> [authentication]
> keyspace = kspace
> {noformat}
> Then exit cqlsh and rerun cqlsh using the cqlshrc just modified.
> Note that you are in keyspace "kspace".
> execute:
> {noformat}
> source 'select.cql' 
> {noformat}
> this will have different behaviour in CQLSH 3.2 and 3.1



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to