Ahmad Amer
Ahmad Amer

Reputation: 39

cassandra bind variables produces error: no viable alternative at input '?'

I'm using cassandra. I am trying to update the gc_grace value using new bind variable.

ALTER table  keyspace.table_name with gc_grace_seconds = ? ;

I got the following error:

no viable alternative at input '?'

How can I solve this?

Upvotes: 1

Views: 267

Answers (2)

Alex Ott
Alex Ott

Reputation: 87174

As I see from the source code (maybe I'm wrong), but ALTER TABLE doesn't support bindings, so you can't use them for this command (and all DDL commands), and need to just use execute with specific value

Upvotes: 2

Erick Ramirez
Erick Ramirez

Reputation: 16323

It looks like you're trying to bind parameters programatically to set GC grace on a table. It isn't possible to do that using the Cassandra drivers.

It will only work through cqlsh. For example:

cqlsh> ALTER TABLE community.maptbl WITH gc_grace_seconds = 3600;

It doesn't make sense to do it in your app and it is not recommended. Cheers!

Upvotes: 1

Related Questions