Bakri Alkhateeb
Bakri Alkhateeb

Reputation: 500

cassandra.protocol.SyntaxException: message="line 0:-1 no viable alternative at input '<EOF>'">

i'm trying to execute this statement but i don't know where the problem is

prepared = session.prepare("SELECT * FROM recipe WHERE meal = Breakfast")

i'm getting this error

cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 0:-1 no viable alternative at input '<EOF>'">

any help would be appreciated

Upvotes: 2

Views: 1681

Answers (1)

Alex Ott
Alex Ott

Reputation: 87164

You simply have incorrect CQL - put Breakfast into single quotes. See documentation on how different data types must be represented.

P.S. also it’s better to prepare a query with placeholder instead of specific value (where meal = ?), and pass that value as parameter when executing the query - then quoting, etc. will be done automatically. See Python driver docs for examples

Upvotes: 3

Related Questions