[DB-SIG] 'long' object has no attribute 'fetchall'
Gerhard Häring
haering_postgresql@gmx.de
Sun, 3 Nov 2002 23:31:33 +0100
* Olivier Collioud <ocollioud@nagora.com> [2002-11-03 23:01 +0100]:
> cursor = cursor.execute('SELECT * FROM articles')
> cursor.fetchall()
>
> Error is:
> AttributeError: 'long' object has no attribute 'fetchall'
cursor.execute returns the number of rows affected. So the line
cursor = cursor.execute('SELECT * FROM articles')
rebinds the name cursor to a long value with the number of changed rows.
Don't do that. Simply do:
cursor.execute('SELECT * FROM articles')
instead.
-- Gerhard