On 20 Dic, 00:03, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Dec 19, 2009, at 4:50 PM, drakkan wrote:
>
>
>
> > On 16 Dic, 19:03, "Michael Bayer" <mike...@zzzcomputing.com> wrote:
> >> drakkan wrote:
> >>> Hi,
> >>> connectionstring = 'sqlite:///' + settings.DATABASE_PATH+'?
> >>> check_same_thread=False'
>
> >>> #engine = create_engine(connectionstring, echo=settings.DEBUG,
> >>> echo_pool=settings.DEBUG)
> >>> engine = create_engine(connectionstring, echo=settings.DEBUG,
>
> >> this line:
>
> >>> pool=NullPool(lambda: sqlite3.connect(settings.DATABASE_PATH)))
>
> >> negates the effect of the "check_same_thread" flag in this line since the
> >> fully constructed pool + creation function you're sending means the URL
> >> isn't used:
>
> >>> engine = create_engine(connectionstring, echo=settings.DEBUG,
>
> >> you only need "pool_class=NullPool" in your create_engine here.  Example
> >> here:http://www.sqlalchemy.org/trac/wiki/DatabaseNotes#SQLite
>
> > thanks, this way works better but there is another problem:
>
> > 1) I make a long select in a separate thread
> > 2) before 1) complete I make an insert or a delete in the main thread
> > 3) when I commit the changes in 2) if the select is still running I
> > get "The transaction is inactive due to a rollback in a
> > subtransaction.  Issue rollback() to cancel the transaction."
>
> that means an exception was thrown within flush(), the transaction was rolled 
> back, and the exception rethrown.  it should propagate outwards where you can 
> catch it, or otherwise it will halt the application and dump to stderr.   if 
> you catch it and ignore it, you get that error when you attempt to continue.

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?

--

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