Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Question changed, answer needed updating.
Source Link
AndySavage
  • 1.8k
  • 1
  • 21
  • 34

Your table (CF) has no field called courseid (hence the error "Undefined name courseid in where clause"). You can't query on something that doesn't exist.

Were you expecting that field there? (Your PK for that table is called 'uuid' if that helps) Are you querying the right table? Not much else to suggest.

Edit: After update

Your CQL3 attempt is missing the quotes around the name, but that aside ... In Cassandra you can't randomly query by non key columns. Cassandra is a partitioned row store, and it is not really designed to do query's in the manner you are trying.

You could add a secondary index to fix this, but you should be aware it not like in traditional SQL. Having a 2ndary index will need to hit all nodes in a cluster do to the query. It's also not ideal if your data has high cardinality.

In Cassandra the general premise is that storage is cheap, and you should base your model on your query rather than your data. Denormalise everything. For example, if you need to pull events by name, then you should make a table that is key'd by name, and includes all the event data you need. That way reading them is (essentially) and O(1) operation.

Your table (CF) has no field called courseid (hence the error "Undefined name courseid in where clause"). You can't query on something that doesn't exist.

Were you expecting that field there? (Your PK for that table is called 'uuid' if that helps) Are you querying the right table? Not much else to suggest.

Your table (CF) has no field called courseid (hence the error "Undefined name courseid in where clause"). You can't query on something that doesn't exist.

Were you expecting that field there? (Your PK for that table is called 'uuid' if that helps) Are you querying the right table? Not much else to suggest.

Edit: After update

Your CQL3 attempt is missing the quotes around the name, but that aside ... In Cassandra you can't randomly query by non key columns. Cassandra is a partitioned row store, and it is not really designed to do query's in the manner you are trying.

You could add a secondary index to fix this, but you should be aware it not like in traditional SQL. Having a 2ndary index will need to hit all nodes in a cluster do to the query. It's also not ideal if your data has high cardinality.

In Cassandra the general premise is that storage is cheap, and you should base your model on your query rather than your data. Denormalise everything. For example, if you need to pull events by name, then you should make a table that is key'd by name, and includes all the event data you need. That way reading them is (essentially) and O(1) operation.

Source Link
AndySavage
  • 1.8k
  • 1
  • 21
  • 34

Your table (CF) has no field called courseid (hence the error "Undefined name courseid in where clause"). You can't query on something that doesn't exist.

Were you expecting that field there? (Your PK for that table is called 'uuid' if that helps) Are you querying the right table? Not much else to suggest.