[Sqlalchemy-tickets] [sqlalchemy] #978: ResultProxy fetches don't wrap DBAPI exceptions
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2008-02-25 00:41:55
|
#978: ResultProxy fetches don't wrap DBAPI exceptions
--------------------+-------------------------------------------------------
Reporter: guest | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: (none) | Severity: no triage selected yet
Keywords: | Status_field: awaiting triage
--------------------+-------------------------------------------------------
I was using SQLALchemy 0.4.3 to read a simple Oracle table in an endless
loop when I shut down the server (on purpose). Apparently this was noticed
after the query was executed but during the fetches on the ResultProxy.
The resulting cx_Oracle exception was not wrapped in a subclass of
DBAPIError. The following code reproduces the problem reliably if you have
the server up at the start then take it down before hitting Return.
{{{
import sys
from sqlalchemy import (create_engine, MetaData, Table, Column,
Integer, String)
engine = create_engine(sys.argv[1])
meta = MetaData(bind=engine)
example = Table("example",
meta,
Column("id", Integer, primary_key=True),
Column("name", String(20))
)
meta.drop_all()
meta.create_all()
example.insert().execute(id=1, name="George")
example.insert().execute(id=2, name="Ursula")
example.insert().execute(id=3, name="Ape")
example.insert().execute(id=4, name="Shep")
example.insert().execute(id=5, name="TookieTookie")
rows = example.select().execute()
raw_input("Type return when the server is down.")
print list(rows)
Type return when the server is down.
Traceback (most recent call last):
File "sabug.py", line 23, in <module>
print list(rows)
File "/tmp/SQLAlchemy-0.4.3/lib/sqlalchemy/engine/base.py", line 1533,
in __iter__
row = self.fetchone()
File "/tmp/SQLAlchemy-0.4.3/lib/sqlalchemy/engine/base.py", line 1633,
in fetchone
row = self._fetchone_impl()
File "/tmp/SQLAlchemy-0.4.3/lib/sqlalchemy/engine/base.py", line 1608,
in _fetchone_impl
return self.cursor.fetchone()
cx_Oracle.DatabaseError: ORA-03113: end-of-file on communication channel
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/978>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python |