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

Warnings when using the perl driver to connect to Cassandra



    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Duplicate
    • None
    • None
    • None
    • All
    • None


      When I use the perl driver 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

      `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.


      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.


        Issue Links



              Unassigned Unassigned
              aswinkarthik Aswin Karthik
              0 Vote for this issue
              1 Start watching this issue