Select using a value from a PickleType fails

Issue #1051 resolved
Former user created an issue

(original reporter: ged) Selects with a where criterion on a PickleType fails when the value itself is coming from a PickeType (see test case).

As a consequence of this, relationships using a PickleType column as a ForeignKey don't work.

After some investigation (print in process_bind_param), the pickled value is different in the cases which don't work. The source value seem to be the same though. There must be some subtle difference that I cannot see. Any idea?

'\x80\x02U\x04testq\x01\x85q\x02.' vs '\x80\x02U\x04test\x85q\x01.'

Comments (3)

  1. Mike Bayer repo owner

    I dont think theres any SQLA issue here. pickle does not produce the identical string each time, particularly with Python datastructures like tuples and dicts, and is not appropriate as a constraint-bearing column type. A better choice would be JSON or similar.

  2. Former user Account Deleted

    (original author: ged) I feared that answer... Didn't know that after all this time using Python... and usually avoiding pickles :)

  3. Log in to comment