[sqlalchemy] Re: mysql innodb table insert problem
Insert into myisam table worked because it does not support transactions? Yes, to my knowledge mysql with myiasm tables will accept, but ignore any 'begin transaction' or 'commit transaction' statements: they are no-ops. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: mysql innodb table insert problem
If I do manual insert into sql server like INSERT INTO lookup (username, shardname) VALUES ('0', 'shard1');, all works fine. But sqlalchemy doesn't insert for whatever reason into innodb table. Here is my shard session: create_session_lookup = sessionmaker(class_=ShardedSession, autoflush=True, transactional=True) I have shard session set to transactional. Does this conflict with innodb transaction? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: mysql innodb table insert problem
I have shard session set to transactional. Does this conflict with innodb transaction? No, but it means your inner sess.begin() and sess.commit() are now within the scope of an outer transaction, so your inner sess.commit() has no effect. Since you immediately issue a sess.clear() after your ineffective sess.commit(), when the outer transaction finally gets a chance to commit, the changes are now gone. If you're going to be handling transaction state yourself, then don't use a transactional session. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: mysql innodb table insert problem
Thanks, I got it to work now. But why did it work for myisam table in the first place. Shouldn't session scope problem also have affected the inserts for myisam table. Insert into myisam table worked because it does not support transactions? On Jul 11, 4:03 pm, Rick Morrison [EMAIL PROTECTED] wrote: I have shard session set to transactional. Does this conflict with innodb transaction? No, but it means your inner sess.begin() and sess.commit() are now within the scope of an outer transaction, so your inner sess.commit() has no effect. Since you immediately issue a sess.clear() after your ineffective sess.commit(), when the outer transaction finally gets a chance to commit, the changes are now gone. If you're going to be handling transaction state yourself, then don't use a transactional session. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---