zzzeek / test_sqlalchemy

0 stars 0 forks source link

Unnessessary update of pickled fields #865

Closed sqlalchemy-bot closed 16 years ago

sqlalchemy-bot commented 17 years ago

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

sqlalchemy-bot commented 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.

sqlalchemy-bot commented 17 years ago

Anonymous wrote:


a test case showing unnesessary UPDATE issued

sqlalchemy-bot commented 16 years ago

Changes by Michael Bayer (zzzeek): set state to "wontfix"

sqlalchemy-bot commented 17 years ago

Changes by Anonymous: set attachment to "pickled_set.py"