On Mar 17, 2011, at 9:11 PM, Martin wrote:

> I have a table with a Text column, which i manually set up as a
> MEDIUMTEXT type in MySQL (5.0), since MySQL's 2**16 character limit is
> not enough for my application. Now when I store large chunks of text
> in that column, and try to get it back, SQLAlchemy raises an
> ResourceClosedError, saying that my result object does not return any
> rows, example:
> 
>>>> res=engine.execute('select id from mytable where length(text)>1000000')
>>>> res.fetchall()
> [('1a9008a84520dc6ec5e4d6607174291d6b10efa3',),
> ('9781c913a78e90587af24706cb96bdbbc5e71a30',)]
>>>> res = engine.execute('select * from mytable where length(text) > 1000000')
>>>> res.fetchall()

It means the MySQLdb cursor object does not have a .description attribute, 
indicating that its not a row-returning construct.  That would appear to be the 
wrong answer from MySQLdb.

Construct a MySQLdb test case for this one to see if this is an error on their 
end:

import MySQLdb

connection = MySQLdb.connect(user='', passwd='', host='', dbname='')
cursor = connection.cursor()
cursor.execute('select * from table where length(text) > 1000000')
assert cursor.description
print cursor.fetchall()



> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/foobar/lib/python2.6/site-packages/SQLAlchemy-0.6.6-py2.6.egg/
> sqlalchemy/engine/base.py", line 2498, in fetchall
>    l = self.process_rows(self._fetchall_impl())
>  File "/foobar/lib/python2.6/site-packages/SQLAlchemy-0.6.6-py2.6.egg/
> sqlalchemy/engine/base.py", line 2467, in _fetchall_impl
>    self._non_result()
>  File "/foobar/lib/python2.6/site-packages/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.
> 
> I googled for the exception type and description, but nothing useful
> came up. Does anyone have an idea what's going wrong here?
> 
> Cheers,
> Martin
> 
> -- 
> 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.

Reply via email to