Hello,

Not sure if it's a Python thing, but...

When sending command to the MySQL server by command line, I can use
SHOW COLUMNS FROM <tablename>, the list of all columns with a bunch of
properties is printed.

However, when I run the same command from Python and I store the
result, the result is an integer that only tell the number of columns.
I would like to get the column names!


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 + "" )
        print str( oResult )
        
        oCursor.close()
        oConnection.close()



Prints "33" (I have 33 columns)


Thanks
Bernard
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to