On Nov 3, 2011, at 9:33 AM, Chris Withers wrote: > Hi All, > > Any idea what this traceback is about? > This query normally works fine and is run a few hundred times a day ;-)
if you use the DBAPI and you say: cursor = conn.cursor() cursor.execute("UPDATE XYZ set foo=bar") if you were to then try to look at the list of "columns returned by this query", that is, cursor.description, you'd get None. Why is that ? Because we just did an UPDATE statement, no columnar results are returned. description is None. If our UPDATE happened to use a RETURNING type of clause, assuming this is supported by both database and DBAPI we *would* get a result set back, and cursor.description should be present. Anyway, SQLAlchemy raises the error you see if you call fetchone()/all() on a result set where cursor.description is not present. Why query(X).with_lockmode('update').all() is doing this appears to be some bug in your DBAPI, because all() emits a SELECT unconditionally. > > cheers, > > Chris > > -------- Original Message -------- > session.query(PasswordRequest).with_lockmode('update').all(): > File "SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/orm/query.py", line 1579, in all > return list(self) > File "SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/orm/query.py", line 1791, in > instances > fetch = cursor.fetchall() > File "SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/engine/base.py", line 2498, in > fetchall > l = self.process_rows(self._fetchall_impl()) > File "SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/engine/base.py", line 2467, in > _fetchall_impl > self._non_result() > File "SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/engine/base.py", line 2472, in > _non_result > "This result object does not return rows. " > sqlalchemy.exc.ResourceClosedError: This result object does not return rows. > It has been closed automatically. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.