Closed sqlalchemy-bot closed 16 years ago
Michael Bayer (zzzeek) wrote:
this is a known issue with the pickle protocol, which is that Python datastructures such as dicts and sets do not produce the same picklestring each time and therefore compare differently. To work around this, use the mutable=False
flag on PickleType
or the comparator
flag. Ive added an FAQ entry at:
FAQ#WhyismyPickleTypecolumnissuingunnecessaryUPDATEstatements
Also I noticed that PickleType
was still using is
for immutable comparison which I've changed to ==
in 268834989c282963e42cc7bf27d17bcb59dca7a0.
Anonymous wrote:
a test case showing unnesessary UPDATE issued
Changes by Michael Bayer (zzzeek): set state to "wontfix"
Changes by Anonymous: set attachment to "pickled_set.py"
Issue created by Anonymous
Hi.
It seems that SA marks property as dirty, when it is not. This applies to Pickle field, where python set() is stored. Items in set can be in different places, because of sorting. Operator == works correctly in this case, but SA marks property as dirty and issues unnesessary update to database.
A test case is applied.
Attachments: pickled_set.py