cqlengine field value manager's explicit flag is True when queried back from cassandra

Description

What is the reason behind this behavior? When I queried back the object, then do an update, None -> None means the field not changed and the DELETE is meaningless. Right?

Environment

None

Pull Requests

None

Activity

Show:
Adam Holmberg
March 8, 2017, 6:25 AM

That is unintentional. Thanks for the report.

Alan Boudreault
March 29, 2017, 2:01 AM

I think your use case already works as expected. Can you double check your item_b.save() line? What is item_b and shouldn't it be 'item.save()' ?

Florian Scherer
March 29, 2017, 2:16 AM

I found the problem (and because of that removed the comment, sorry for that).

Here is my code again:

My issue was that the cqlengine registered which columns were changed (only data_b in my case) and then only wrote these to the database.
My workaround for persisting the whole item would be to use:

Alan Boudreault
March 30, 2017, 1:13 AM

Indeed, there is no reason item.save() would save data_1 again since its internal state hasn't changed. It's better to use TestItem.create() and/or a new instance like TestItem(uuid=1, data_1=u'data_1', data_2='data_2_deleted').save()

Jaume Marhuenda
April 5, 2017, 11:55 PM
Edited

LGTM, I've added some tests here.

Fixed

Assignee

Unassigned

Reporter

lishuo

Fix versions

Labels

Reproduced in

None

PM Priority

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Pull Request

None

Affects versions

Priority

Major