yes, this is kind of an unfortunate default that we've had throughout  
the 0.4 series, which we wont have in 0.5.  To get the behavior you  
want, use this:

engine = create_engine('postgres://...', pool_threadlocal=False)


Alternatively, bind each session to the non-contextual connection,  
using session(bind=engine.connect()), though thats a little more effort.


On May 18, 2008, at 9:52 PM, Matthew Dennis wrote:

> #!/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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to