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

[sqlalchemy] Checking the handling of unique keys/indexes

2014-12-20 Thread SF Markus Elfring
Hello, I am using source code like the following in one of my scripts where I am trying the software packages SQLAlchemy 0.9.7-77.1 and SQLite 3.8.7.2-1.1 out on my openSUSE system. ... engine = create_engine(sqlite:///:memory:, echo = False) base = declarative_base() class position(base):