[英]com.datastax.driver.core.exceptions.InvalidQueryException: PRIMARY KEY part sequence found in SET part
I am trying to update the table, then i am getting this exception: 我正在尝试更新表,然后我得到这个例外:
com.datastax.driver.core.exceptions.InvalidQueryException: PRIMARY KEY part sequence found in SET part.
com.datastax.driver.core.exceptions.InvalidQueryException:在SET部分中找到的PRIMARY KEY部分序列。
My table structure is 我的表结构是
CREATE TABLE IF NOT EXISTS STYLINGBEE.LKPSTYLES(
STYLEID ASCII,
NAME ASCII,
IMAGE ASCII,
SEQUENCE INT,
ACTIVE BOOLEAN,
PRIMARY KEY (STYLEID,SEQUENCE)
)WITH CLUSTERING ORDER BY (SEQUENCE DESC);
While having your complete query would help, I can tell from the error message that you are trying to UPDATE
a row's PRIMARY KEY
. 虽然拥有完整的查询会有所帮助,但我可以从错误消息中判断出您正在尝试
UPDATE
行的PRIMARY KEY
。 From the DataStax documentation on the UPDATE command : 从UPDATE命令的DataStax文档 :
The UPDATE SET operation is not valid on a primary key field.
This is why you are getting this particular error message. 这就是您收到此特定错误消息的原因。 If you have inserted a row containing a part of the primary key that you need to update, you will have to remove that row and re-insert it.
如果您插入了包含需要更新的主键部分的行,则必须删除该行并重新插入。
Cassandra don't allow you to update primary key. Cassandra不允许您更新主键。 You can not do something like below because SEQUENCE is part of primary key.
你不能做下面的事情,因为SEQUENCE是主键的一部分。
UPDATE STYLINGBEE.LKPSTYLES SET SEQUENCE = 1 WHERE STYLEID = 1000; UPDATE STYLINGBEE.LKPSTYLES SET SEQUENCE = 1 WHERE STYLEID = 1000;
It looks like you are trying to update some row without STYLEID specified in your query (WHERE part). 看起来您正在尝试更新某些行而不在查询中指定STYLEID(WHERE部分)。 Could you please publish your CQL statement.
你能发布你的CQL语句吗? I think this one link could help you: Why doesn't my Cassandra update work?
我认为这一个链接可以帮助您: 为什么我的Cassandra更新不起作用?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.