On Nov 6, 2011, at 8:41 AM, Wei-Ning Huang wrote:
>
> db.query(Table).filter(...).update({'stamp': stamp})
> db.commit()
> results = db.query(Table).filter_by(stamp=stamp).all() # ResourceClosedError
> raised here
>
> and the traceback print out the error at this point. If I'm understanding
> correctly, you said that the cursor is closed since the update
> statement does not return any results. Since the cursor is closed so it
> rendered my next select statement invalid?
no, not quite - the above indicates a SELECT is emitted, and then the cursor
has no .description attribute. This is a bug in either MySQL or mysql-python,
or is some side effect of your application's environment or possibly high
concurrency load. When a SELECT is emitted, cursor.description should never
be None, regardless of if there are actually rows or not. I can't say exactly
why you are seeing this. Reproducing it as a MySQL-python test case would be
key to reporting a bug for the Mysql-python project (also called MySQLdb).
> So in theory
> if I can reconnect (create a new session) to the database, I can get the next
> select results without the ResourceClosedError, am I
> correct?
reconnecting may resolve the symptom here but there's something weird going on
for sure.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.