Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python cassandra.protocol.SyntaxException:message=";第0行:-1输入端没有可行的替代方案'&书信电报;EOF>'&引用&燃气轮机;_Python_Cassandra_Cql - Fatal编程技术网

Python cassandra.protocol.SyntaxException:message=";第0行:-1输入端没有可行的替代方案'&书信电报;EOF>'&引用&燃气轮机;

Python cassandra.protocol.SyntaxException:message=";第0行:-1输入端没有可行的替代方案'&书信电报;EOF>'&引用&燃气轮机;,python,cassandra,cql,Python,Cassandra,Cql,我试图执行此语句,但我不知道问题出在哪里 prepared = session.prepare("SELECT * FROM recipe WHERE meal = Breakfast") 我犯了这个错误 cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 0:-1 no viable alter

我试图执行此语句,但我不知道问题出在哪里

prepared = session.prepare("SELECT * FROM recipe WHERE meal = Breakfast")
我犯了这个错误

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

任何帮助都将不胜感激

您的CQL不正确-请将早餐用单引号括起来。请参见关于必须如何表示不同数据类型的说明


另外,最好使用占位符而不是特定值(
where mean=?
)来准备查询,并在执行查询时将该值作为参数传递,然后自动进行报价等操作。请参阅Python驱动程序文档以获取示例

您的CQL不正确-将早餐放在单引号中。请参见关于必须如何表示不同数据类型的说明


另外,最好使用占位符而不是特定值(
where mean=?
)来准备查询,并在执行查询时将该值作为参数传递,然后自动进行报价等操作。有关示例,请参见Python驱动程序文档

谢谢,它成功了谢谢,它成功了