My table has a unique index on the column named "tag". When I attempt to insert a row with a tag value that already exists in the table, sqlalchemy raises the generic exception `IntegrityError`.
`IntegrityError` may be raised for various scenarios, including Foreign Key Violation and Unique Index Violation. One of the benefits of using sqlalchemy is the ability to write code that may be independent of the underlying backend or db-api driver. So, I am hoping that there is a programmatic way to distinguish between the underlying causes of IntegrityError (such as unique constraint violation) without having to depend explicitly on a specific driver package (e.g., psycopg2). Thank you, Vitaly -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/718de06d-97ae-4f73-8614-a4fd0626826fn%40googlegroups.com.