I am trying to make a query with cassandra-driver, specifying the keyspace as an option, but am getting the error "No keyspace has been specified."
I am using the following code
connection = new driver.Client({ contactPoints: ['abc'] });
connection.execute(query, { keyspace: 'system_schema' })
Can anyone help me understand what I'm missing?
You need to specify keyspace as option to the Client
, in your case it should be as following:
connection = new driver.Client({contactPoints: ['abc'], keyspace: 'system_schema'});
connection.execute(query, queryOptions, callback);
See documentation on ClientOptions & QueryOptions .
If you need to access table in another namespace, then you need to use fully qualified table name in the query - as keyspace_name.table_name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.