[ https://issues.apache.org/jira/browse/CASSANDRA-18495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17719203#comment-17719203 ]
Aswin Karthik commented on CASSANDRA-18495: ------------------------------------------- Thanks for the response. Not sure if it is a duplicate. This does involve any creation of tables/keyspaces. It is about the recommended way to initialize a session on a driver. >From a driver's perspective, what is the right way to choose a keyspace on a >connection? > Warnings when using the perl driver to connect to Cassandra > ----------------------------------------------------------- > > Key: CASSANDRA-18495 > URL: https://issues.apache.org/jira/browse/CASSANDRA-18495 > Project: Cassandra > Issue Type: Bug > Reporter: Aswin Karthik > Priority: Normal > > When I use the [perl driver|https://github.com/TvdW/perl-DBD-Cassandra] to > connect to Cassandra 4.0.3 and onwards, I get the following error just for > initialization of a connection. > The error I get is > {noformat} > `USE <keyspace>` with prepared statements is considered to be an anti-pattern > due to ambiguity in non-qualified table names. Please consider removing > instances of `Session#setKeyspace(<keyspace>)`, `Session#execute("USE > <keyspace>")` and `cluster.newSession(<keyspace>)` from your code, and always > use fully qualified table names (e.g. <keyspace>.<table>). Keyspace used: > null, statement keyspace: null, statement id: <id> at > Cassandra/Client/Connection.pm line 957. > {noformat} > > This is just from initialization of the perl driver connection while choosing > the keyspace. > [https://github.com/TvdW/perl-DBD-Cassandra/blob/master/Cassandra-Client/lib/Cassandra/Client/Connection.pm#L562] > before running any queries. It is emitted even if I use qualified prepared > statement. > The same warning does not pop up in Datastax java driver initialization. > On debugging, I found that this warning does not emit for all unqualified > prepared statements. It only emits for unqualified prepared "USE ks" > statement. But the "USE ks" can never be qualified. So the warning is a bit > vague on what is the recommended approach. > And from the perspective of the driver, it is setting the keyspace of the > connection for the first time. The same warning does not happen on the > datastax java driver and that is because it uses QUERY to set the keyspace on > connection. (I tried to follow the same approach on the perl driver - > https://github.com/TvdW/perl-DBD-Cassandra/pull/35 ) > The warnings are not very clear on what is deprecated and what is not. Does > it deprecate only the use of prepared statement of "USE ks"? or does it > deprecate "USE ks" completely? And it is not being emitted for other > unqualified prepared statements but only for a USE statement which cannot be > qualified at all. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org