Closed michaelmior closed 10 years ago
Sorry, I see after looking at the test results that the intention seems to be that the keyspace name be passed already in quotes. This seems like a strange choice to me. Any particular reason not to just automatically quote all keyspace names?
I'm not super happy about how keyspace names are handled. I probably never should have added the Client#use
method. Originally I wasn't aware that there was an issue with the casing of keyspace names. Since they are defined as case insensitive in CQL I had just assumed that would apply to Thrift keyspaces too, but that was wrong (and that's where the quotes come from, it's a way to even make it possible to use #use
and the :keyspace
option to change to a Thrift keyspace).
This patch would not be possible to merge without a major version bump. It makes the handling of keyspace names case sensitive, which is not what you would expect in CQL – and code that relied on the case insensitivity of the current implementation would break.
There will shortly be a new Cassandra driver for Ruby that will replace cql-rb, so if you feel strongly about this issue please open an issue there and maybe we can get something that works better into that driver. Currently it does not have a #use
method, but the keyspace name you pass into #connect
is not quoted, so you would have the same problem as with cql-rb.
Personally I think that if you're working with Thrift keyspaces then having to do client.execute('USE "MyKeyspace"')
instead of client.use('MyKeyspace')
, isn't a big deal. There's so many other things that work differently with Thrift keyspaces anyway.
Thanks for the clarification. Coming from using Thrift, I didn't realize that keyspaces are supposed to be case-insensitive in CQL. Given that, I agree that there doesn't really need to be any changes made.
Currently
use_keyspace
will only work for keyspace names which are all lower case. Quoting the argument toUSE
is a simple fix. Would be nice if a new minor version of the gem could be released if possible.