Hi, Michael Bayer. Thanks, that example is really helpful. In your example I used *Session.object_session*<http://docs.sqlalchemy.org/en/latest/orm/session.html#sqlalchemy.orm.session.Session.object_session>method to verify that main_method and method1 running in two different sessions. But my test result showing that main_method and method1 running in same session. I think, we can check this using method *Session.object_session** *, I am not sure about that.
* added following code in main_method s1 = Session.object_session(db_obj1) print "=======main_method====session=====", vars(s1) * added following code in method1 s2 = Session.object_session(db_obj2) print "=======method1====session=====", vars(s2) *Result =========* *=======main_method====session=====* " {'autocommit': False, 'autoflush': True, 'transaction': <sqlalchemy.orm.session.SessionTransaction object at 0x22a5f90>, *'hash_key': 36330896*, 'expire_on_commit': True, '_new': {}, 'bind': Engine(mysql://root:cvt@localhost/cvt_ee), '_deleted': {}, '_flushing': False, 'identity_map': {(<class '__main__.A'>, (1L,)): <sqlalchemy.orm.state.InstanceState object at 0x22a5c90>}, '_enable_transaction_accounting': True, 'extensions': [], '_identity_cls': <class 'sqlalchemy.orm.identity.WeakInstanceDict'>, 'twophase': False, '_Session__binds': {}, '_query_cls': <class 'sqlalchemy.orm.query.Query'>, '_mapper_flush_opts': {}} =======method1====session===== {'autocommit': False, 'autoflush': True, 'transaction': <sqlalchemy.orm.session.SessionTransaction object at 0x2073190>,* 'hash_key': 36330896,* 'expire_on_commit': True, '_new': {}, 'bind': Engine(mysql://root:cvt@localhost/cvt_ee), '_deleted': {}, '_flushing': False, 'identity_map': {(<class '__main__.A'>, (2L,)): <sqlalchemy.orm.state.InstanceState object at 0x2073550>, (<class '__main__.A'>, (1L,)): <sqlalchemy.orm.state.InstanceState object at 0x22a5c90>}, '_enable_transaction_accounting': True, 'extensions': [], '_identity_cls': <class 'sqlalchemy.orm.identity.WeakInstanceDict'>, 'twophase': False, '_Session__binds': {}, '_query_cls': <class 'sqlalchemy.orm.query.Query'>, '_mapper_flush_opts': {}} -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/qzSbUaBu8UoJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.