squelching typically means one of two things.

either you're doing this:

try:
     # do stuff with session
except:
    print "error !"
    # .. keep going

or, you are allowing concurrent access to a single session with  
multiple threads, one of your threads is throwing an exception  
(usually due to the corrupted state of the session, since the session  
is not mutexed) and the other thread gets this error.


On Apr 28, 2009, at 4:53 PM, Daniel wrote:

>
> Hello,
>
> In my application I have a function that looks more or less like this
>
>    def run(self):
>        # process first object in sequence
>        for firstObject in firstObjects:
>            self.session.add(firstObject)
>        self.session.commit()
>
>        # process second object in sequence
>        # lots of these, so break along the way
>        count = 0
>        for secondObject in secondObjects:
>            self.session.add(secondObject)
>            count += 1
>            if (count > 100):
>                #**********************************
>                self.session.commit()
>                #**********************************
>                count = 0
>                time.sleep(1)   # pause to let other process access
> the db
>        self.session.commit()
>
>        # process third objects
>        for thirdObject in thirdObjects:
>            self.session.add(thirdObject)
>        self.session.commit()
>
> The commit nested inside the second loop (highlighted by asterisks) is
> potentially called many times (occasionally there are thousands of
> objects to deal with).  intermittently that commit will produce the
> following error:
>
> Traceback (most recent call last):
>  File "C:\Aptina\pop\tester\AptinaStagingService.py", line 106, in
> __init__
>    self.run(self.pushPath,self.stagingPath)
>  File "C:\Aptina\pop\tester\AptinaStagingService.py", line 231, in
> run
>    self.session.commit()
>  File "c:\python25\Lib\site-packages\sqlalchemy\orm\session.py", line
> 673, in commit
>    self.transaction.commit()
>  File "c:\python25\Lib\site-packages\sqlalchemy\orm\session.py", line
> 378, in commit
>    self._prepare_impl()
>  File "c:\python25\Lib\site-packages\sqlalchemy\orm\session.py", line
> 351, in _prepare_impl
>    self._assert_is_active()
>  File "c:\python25\Lib\site-packages\sqlalchemy\orm\session.py", line
> 247, in _assert_is_active
>    "The transaction is inactive due to a rollback in a "
> InvalidRequestError: The transaction is inactive due to a rollback in
> a subtransaction.  Issue rollback() to cancel the transaction.
>
> I've read elsewhere in this group (http://groups.google.com/group/
> sqlalchemy/browse_thread/thread/b87af73232998fe4) about this error
> message, but I'm not sure what they mean by "squelching the original
> exception somewhere".  Can someone please help me understand why I'm
> getting this error and ideas on how to fix it.
>
> Thanks.
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to