Hi,
I'm testing out the below script with MySQL 5.0.51a and SA 0.4.6.
Based on the documentation I expected to see a SAVEPOINT be created
(at some point) and rolled-back to but instead I get the following:
>>> satest.doit()
2008-05-14 12:42:37,813 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc BEGIN
2008-05-14 12:42:37,814 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc INSERT INTO test_table (name) VALUES (%s)
2008-05-14 12:42:37,814 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc ['outer']
2008-05-14 12:42:37,815 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc INSERT INTO test_table (name) VALUES (%s)
2008-05-14 12:42:37,815 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc ['inner']
2008-05-14 12:42:37,816 INFO sqlalchemy.engine.threadlocal.TLEngine.
0x..cc COMMIT
Am I doing something wrong? I looked thru this mailing-list, bug
reports and documentation but couldn't see anything obvious.
Thanks!
-- Jacob
The script is:
from sqlalchemy import *
from sqlalchemy.orm import *
engine = create_engine('mysql://[EMAIL PROTECTED]/test', echo=True,
strategy='threadlocal')
meta = MetaData()
meta.bind = engine
test_table = Table('test_table', meta,
Column('test_id', Integer, primary_key=True),
Column('name', String(40)),
mysql_engine='InnoDB')
meta.create_all()
class MyTest(object):
def __init__(self, test_name):
self.name = test_name
mapper(MyTest, test_table)
Session = sessionmaker(transactional=False, autoflush=True,
bind=engine)
def doit():
sess = Session(transactional=False)
sess.begin()
t = MyTest("outer")
sess.save(t)
sess.flush()
def inner():
sess.begin_nested()
t2 = MyTest("inner")
sess.save(t2)
sess.rollback()
inner()
sess.commit()
if __name__ == '__main__':
doit()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---