Re: [sqlalchemy] ResourceClosedError on Postgres

2014-12-21 Thread Michael Bayer
you are using ZopeTransactionExtension so you should not be calling session.rollback(). Please read the docs for ZopeTransactionExtension at https://pypi.python.org/pypi/zope.sqlalchemy. alchemy1 veerukrish...@hotmail.com wrote: Also my DBSession is defined like this DBSession =

Re: [sqlalchemy] Checking the handling of unique keys/indexes

2014-12-21 Thread Michael Bayer
SF Markus Elfring elfr...@users.sourceforge.net wrote: Now I stumble on an error message like the following. ... cursor.executemany(statement, parameters) sqlalchemy.exc.IntegrityError: (IntegrityError) UNIQUE constraint failed: positions.function, ... The message might be

Re: [sqlalchemy] Checking the handling of unique keys/indexes

2014-12-21 Thread SF Markus Elfring
SQLAlchemy sends to the log the statement and parameters it is to send to the DBAPI cursor.execute() method, *before* it actually does so. This so that if the DBAPI throws an exception, as is the case here, one can see what instructions were sent to it which were the immediate cause of this

Re: [sqlalchemy] Checking the handling of unique keys/indexes

2014-12-21 Thread Michael Bayer
SF Markus Elfring elfr...@users.sourceforge.net wrote: SQLAlchemy sends to the log the statement and parameters it is to send to the DBAPI cursor.execute() method, *before* it actually does so. This so that if the DBAPI throws an exception, as is the case here, one can see what instructions

Re: [sqlalchemy] Checking the handling of unique keys/indexes

2014-12-21 Thread SF Markus Elfring
Should I get the exception sqlalchemy.exc.IntegrityError directly after I attempted to insert a second record set with unique attributes into a SQLite table? I don’t have a stack trace here to see what the nature of the issue is but it is likely that the INSERT is proceeding using DBAPI

Re: [sqlalchemy] Checking the handling of unique keys/indexes

2014-12-21 Thread Michael Bayer
SF Markus Elfring elfr...@users.sourceforge.net wrote: Should I get the exception sqlalchemy.exc.IntegrityError directly after I attempted to insert a second record set with unique attributes into a SQLite table? I don’t have a stack trace here to see what the nature of the issue is but it

Re: [sqlalchemy] Checking the handling of unique keys/indexes

2014-12-21 Thread SF Markus Elfring
There is no way to use the second form while being able to record the moment each parameter set is used, unless the DBAPI itself provides additional hooks for logging at this level. However, this logging would defeat some of the purpose of executemany(), which is that of processing many