- changed status to resolved
String column with Sequence breaks identity map
Issue #782
resolved
I'm trying to create a class with an id of type 'str' that autoincrements by default (e.g. '1', '2', etc). I gave its corresponding table a String column with an associated Sequence.
If I save an instance, its id is populated with a long, but if I then retrieve the instance from the database, an object with an id of type 'str' is (correctly) returned. This causes the session's identity map lookup to fail.
Comments (1)
-
repo owner - Log in to comment
sequences are often executed "inline" with a SQL INSERT statement (as of 0.4), so any python-side conversion to string is not portable (also, sequences are specifically for integers so i dont favor any new bells and whistles within Sequence). instead, do the conversion yourself with a pre-executed default (0.4 example):