Thanks I found my error:

I defined my session as scoped session but in a global file I was
redefining it as session=sess() and session was not more scoped

On 20 Dic, 00:37, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Dec 19, 2009, at 6:20 PM, drakkan wrote:
>
>
>
> > Sorry, I don't fully understand you answer:
>
> > I have a main application that start a new thread to do a long running
> > task, while the thread is running the main app do other things and
> > when it commit the changes the thread has an exception caused by this
> > commit, is the exception propagated to the main app even if I catch it
> > in the thread? Why I have the exception only if the main app do a
> > commit and no expetion if I wait the end of the thread before do other
> > things?
>
> Not sure what you have going on here, but if you are sharing the same Session 
> object (not a "scoped_session", but the actual "session") between threads, 
> you will get many errors - the Session is not threadsafe.    That's the only 
> way you could get behavior like "the exception is propagated to the main app 
> even if I catch it in the thread".
>
> If you are using a different Session in the main app versus the thread, then 
> the only way you can get that error is if the Session has an exception, and 
> you continue to try to use that same Session without rolling it back.    I 
> just added some detail to the FAQ section which includes an example 
> athttp://www.sqlalchemy.org/trac/wiki/FAQ#Thetransactionisinactivedueto....
>
>
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "sqlalchemy" group.
> > To post to this group, send email to sqlalch...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > sqlalchemy+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/sqlalchemy?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.


Reply via email to