patternModerate
Querying from system.schema_keyspaces generates code=2200 [Invalid query]
Viewed 0 times
generatesinvalidschema_keyspacessystemqueryquerying2200codefrom
Problem
I'm following Cassandra docs to learn CQL but when I type the query
SELECT * from system.schema_keyspaces; the system generates
InvalidRequest: code=2200 [Invalid query] message= unconfigured table system.schema_keyspaces. Although I'm able to execute another quires like create, update..etc.
SELECT * from system.schema_keyspaces; the system generates
InvalidRequest: code=2200 [Invalid query] message= unconfigured table system.schema_keyspaces. Although I'm able to execute another quires like create, update..etc.
Solution
The issue you are having here, is that you are using docs to explore Cassandra that are for version 2.0 and 2.1. My guess is that you are probably using Cassandra 3.0. In that case, you will need to query the system_schema keyspace for the "keyspaces" table:
Cassandra underwent a major storage engine rewrite for 3.0+, so much of the schema interactions are different as of that version. In the future, be sure to double-check valid documentation versions with your local Cassandra version. From cqlsh, you can query that:
cassandra@cqlsh:system_schema> SELECT * FROM system_schema.keyspaces;
keyspace_name | durable_writes | replication
--------------------+----------------+----------------------------------------------------------------------------------------
test | True | {'PowerWindows': '1', 'class': 'org.apache.cassandra.locator.NetworkTopologyStrategy'}
system_auth | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1'}
system_schema | True | {'class': 'org.apache.cassandra.locator.LocalStrategy'}
system_distributed | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
system | True | {'class': 'org.apache.cassandra.locator.LocalStrategy'}
system_traces | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '2'}
(6 rows)Cassandra underwent a major storage engine rewrite for 3.0+, so much of the schema interactions are different as of that version. In the future, be sure to double-check valid documentation versions with your local Cassandra version. From cqlsh, you can query that:
cassandra@cqlsh:system_schema> SELECT release_version from system.local;
release_version
-----------------
3.4
(1 rows)Code Snippets
cassandra@cqlsh:system_schema> SELECT * FROM system_schema.keyspaces;
keyspace_name | durable_writes | replication
--------------------+----------------+----------------------------------------------------------------------------------------
test | True | {'PowerWindows': '1', 'class': 'org.apache.cassandra.locator.NetworkTopologyStrategy'}
system_auth | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1'}
system_schema | True | {'class': 'org.apache.cassandra.locator.LocalStrategy'}
system_distributed | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
system | True | {'class': 'org.apache.cassandra.locator.LocalStrategy'}
system_traces | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '2'}
(6 rows)cassandra@cqlsh:system_schema> SELECT release_version from system.local;
release_version
-----------------
3.4
(1 rows)Context
StackExchange Database Administrators Q#149977, answer score: 17
Revisions (0)
No revisions yet.