The following test case of mine fails on PG 8.3 and SA 0.4.3 Basically,
create two sessions, make some changes in the first and obverse they are
visible before commit/rollback in the second (and via connectionless
execution directly on the engine), but become unvisible after rollback. The
first two print statements both show a row returned (that should only be
visible from s0), but after the rollback the print statements show there are
no values. It's almost like a threadlocal strategy is being used when it
was never configured. Ideas/thoughts/comments?
#!/usr/bin/python
from sqlalchemy.sql import text
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine('postgres://[EMAIL PROTECTED]/testsatransaction')
new_session = sessionmaker(bind=engine, transactional=True)
engine.execute(text("drop table if exists foo"))
engine.execute(text("create table foo(c1 int)"))
s0 = new_session()
s1 = new_session()
s0.execute(text("insert into foo values(1)"))
(one,) = s0.execute(text("select * from foo")).fetchone()
assert one == 1
print engine.execute(text("select * from foo")).fetchone()
print s1.execute(text("select * from foo")).fetchone()
s0.rollback()
print engine.execute(text("select * from foo")).fetchone()
print s1.execute(text("select * from foo")).fetchone()
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---