How to access psycopg2 error wrapped in sqlalchemy error
问题 I'm uploading a pandas data frame to a table in Postgres using SQLalchemy and psycopg2. How do I access the psycopg2 error that is within the SQLalchemy error? I want to write an exception into my code only when it raises an error because of a null value in a column that violates not-null constraint. I know how to test for this exact pSQL error with psycopg2, but when I run my code it returns a SQLalchemy error. Here's the error: SQLalchemy.exc.IntegrityError: (psycopg2.errors