Ah yeah I to mention that I indeed tried fetchall(), but Python would
raise an attribute error:
def getTableColumns( sTableName ):
""" Lists and returns the list of columns from a given table. """
oConnection = connect2db()
oCursor = oConnection.cursor()
oResult = oCursor.execute( "SHOW COLUMNS FROM " + sTableName + "" )
aRow = oResult.fetchall()
print str( aRow )
oCursor.close()
oConnection.close()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "\\Linuxserver\prod\XSI\WORKGROUP_4.0\Data\Scripts\pipeline\sql.py",
line 153, in getTableColumns
aRow = oResult.fetchall()
AttributeError: 'long' object has no attribute 'fetchall'
Thanks
Bernard
On 7/19/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
> > oResult = oCursor.execute( "SHOW COLUMNS FROM " + sTableName + "" )
>
> Hi Bernard,
>
> Try using oCursor.fetchall() after the execution. The return value of
> execute() are the number of rows affected, and you can then pull each
> fetched value by using either oCursor.fetchone() or oCursor.fetchall().
>
> See:
>
> http://python.org/peps/pep-0249.html
>
> for more details about this. Hope this helps!
>
>
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor