diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-08-03 11:55:12 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-08-03 11:55:12 -0400 |
commit | ddf4210552fdff864a885b1ec6aa238105b16e8f (patch) | |
tree | ae6e1c4231385954a8dd5252ffb715b5da6f5a4b /lib/sqlalchemy/exc.py | |
parent | 5cd1d43bec73db77d26e6f663e2449e911520737 (diff) | |
download | sqlalchemy-ddf4210552fdff864a885b1ec6aa238105b16e8f.tar.gz |
- Calling fetchone() or similar on a result that
has already been exhausted, has been closed,
or is not a result-returning result now
raises ResourceClosedError, a subclass of
InvalidRequestError, in all cases, regardless
of backend. Previously, some DBAPIs would
raise ProgrammingError (i.e. pysqlite), others
would return None leading to downstream breakages
(i.e. MySQL-python).
- Connection, ResultProxy, as well as Session use
ResourceClosedError for all "this
connection/transaction/result is closed" types of
errors.
Diffstat (limited to 'lib/sqlalchemy/exc.py')
-rw-r--r-- | lib/sqlalchemy/exc.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index 31826f44f..1c412824c 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -60,6 +60,10 @@ class InvalidRequestError(SQLAlchemyError): """ +class ResourceClosedError(InvalidRequestError): + """An operation was requested from a connection, cursor, or other + object that's in a closed state.""" + class NoSuchColumnError(KeyError, InvalidRequestError): """A nonexistent column is requested from a ``RowProxy``.""" |