On Mar 20, 2014, at 7:46 AM, RedBaron <dheeraj.gup...@gmail.com> wrote:
> Hi, > It looks like session.merge() converts String type primary key to its > lower-case equivalent before processing. > > T1 = Test1('A','My name is a') > session.merge(T1) > session.commit() > T2 = Test1('a','My name is also a') Your script changes the value to lower case because you are actually specifying a lower case 'a' as the new value for the primary key. It matches the original because of MySQL's default collation behavior. Here's a simple test: mysql> select 'A' = 'a'; +-----------+ | 'A' = 'a' | +-----------+ | 1 | +-----------+ 1 row in set (0.00 sec) mysql> The object specified in T2 matches, SQLAlchemy does as it's instructed and updates all the attributes of T1 to match the new one. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.