[Sqlalchemy-tickets] Issue #4066: feature request- extend core DBAPIError exceptions with connectio
Brought to you by:
zzzeek
From: jvanasco <iss...@bi...> - 2017-09-01 17:52:31
|
New issue 4066: feature request- extend core DBAPIError exceptions with connection/engine information if available https://bitbucket.org/zzzeek/sqlalchemy/issues/4066/feature-request-extend-core-dbapierror jvanasco: in a trivial example, given a session with a database that does not contain `foo`... try: sess.execute("SELECT foo;") except Exception as e: print "Exception!", e pdb.set_trace() `e` will be a `sqlalchemy.exc.ProgrammingError` (under Postgres and others, which inherits from `DBAPIError`). The current design of `DBAPIError` makes it hard to tell what connection caused the error -- which is important in multi-connection environments (and probably connection pools). The may be raw connection info via the underlying connections's cursor (`e.orig.cursor.connection` works for postgres via pyscopg2), but this request is to make information about the SqlAlchemy Connection object on the DBAPIError . |