Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error querying table schema: Undefined name key_aliases in selection clause #27

Open
maticmeznar opened this issue Sep 5, 2015 · 9 comments

Comments

@maticmeznar
Copy link

I'm new to Cassandra (version 2.2.1) and I've been using http://relops.com/cqlc/start/ to get me started with accessing it from Go. I'm able to create the keyspace using the linked schema.cql, but when I run the cqlc command in the example, I get the error: " Error querying table schema: Undefined name key_aliases in selection clause".

What is wrong? Why isn't it working?

@nsd20463
Copy link
Contributor

nsd20463 commented Sep 5, 2015

I'm not the cqlc author, but we happened to find this same error the other day. It comes from the getTableMetaData() function of the gocql package. cqlc uses this function to read the schema. Cassandra 2.2 removed key_aliases (and column_aliases and value_aliases) from this table. So the function breaks.

The quick fix is to use Cassandra 2.1.

@maticmeznar
Copy link
Author

@nsd20463 Thank you! You just saved me a lot of time. I hope support for Cassandra 2.2 is added soon. What does the cqlc author say about that?

@0x6e6562
Copy link
Member

0x6e6562 commented Sep 9, 2015

@maticmeznar I don't see why this shouldn't be added, considering that 2.2.0 is now one of the supported versions in gocql. I can let you know when that happens, or if you want to speed the process up a bit, feel free to raise a PR.

@0x6e6562
Copy link
Member

0x6e6562 commented Sep 9, 2015

I've had a closer look at this and have tried a few things out. It turns out that setting ProtoVersion on the gocql cluster config to 4 will avoid the issue with key_aliases. However, there are other few compatibility issues that need to get cleaned up to declare this to be ready for 2.2.+

@maticmeznar
Copy link
Author

@0x6e6562 Thank you for looking into this. I've currently resorted to using plain gocql as I can't find a way to set per query consistency level when using cqlc. I presume it's not supported.

@0x6e6562
Copy link
Member

@maticmeznar cqlc tries not to hide any of the gocql API from the app, but there may be some use cases where it doesn't achieve this - in which case we would need to revise the cqlc API to make this happen.

However, I'm wondering whether this part of the user guide can give you an idea of how to access the *gocql.Query object to set the per-query consistency level?

@0x6e6562
Copy link
Member

@maticmeznar @nsd20463 I've just merged #29 which now runs the test suite against 2.1.9 and 2.2.1 (and in doing so, deprecating support for 2.0.x). The functional change in the cqlc compiler is that it now looks for the native version of the server from which it is trying to harvest the schema. If it detects that the protocol version is above 3 (i.e. as in the case of 2.2.x), cqlc will re-connect to the server using the upgraded protocol version. This avoids the key_aliases issue in 2.2.x. Let me know if this works for you.

@bobu
Copy link

bobu commented Oct 21, 2015

I've just verified that this fixes support for Cassandra 2.2 (in my case, I'm running 2.2.3).

@0x6e6562
Copy link
Member

0x6e6562 commented Nov 4, 2015

@bobu Many thanks for verifying this fix :-)

@maticmeznar @nsd20463 I'll still leave this issue open for a while to give you more time to try this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants