On Oct 22, 2007, at 4:25 AM, alain D. wrote:

>
>  Obj is a simple python object with on field (key : String(10)) mapped
> to a table with on field (key) with is the primary key.
> Session is defined like this :
> engine = create_engine("**mysql_string**", strategy='threadlocal',
> pool_size=50)
> Session = scoped_session(sessionmaker(bind=engine, autoflush=True,
> transactional=True))
>
>   If I launch 2 python shells :
>   In the first I do :
> sess = Session()
> obj = Obj("first_key")
> sess.save()
> sess.commit()
>
>   In the second I do
> sess = Session() #this is done at the same time than the creation in
> the first shell
> # wait after commit in shell 1
> oo = sess.query(Obj).filter_by(key="first_key").first
> # oo is None
>

its likely that a transaction is begun in the second session before  
the first session commits - transaction isolation will prevent #2  
from seeing new changes until its either rolled back or committed.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to