Getting Default Values Out of MySQL

Carsten Haese carsten.haese at gmail.com
Sat Dec 12 13:31:39 EST 2009


Victor Subervi wrote:
> 
> 
> On Sat, Dec 12, 2009 at 10:54 AM, Carsten Haese <carsten.haese at gmail.com
> <mailto:carsten.haese at gmail.com>> wrote:
> 
>     Victor Subervi wrote:
>     > Hi;
>     > I'm using MySQLdb. If I do a
>     > cursor.execute('describe myTable;')
>     > it gives me all sorts of data but not my default values.
> 
>     That function call doesn't "give" any data at all, except for the
>     rowcount (which would be the number of columns in the table). 
> 
> 
> Really?

Yes, really.

>     cursor.execute('describe %s;' % store)
>     storeDescription = cursor.fetchall()
>     print storeDescription
> 
> Prints out this:
> [snip...]

So it does. And if you look really, really carefully, maybe you'll be
able to tell the difference between this, your original code snippet:

    cursor.execute('describe %s;' % store)

And this, which is what *actually* produces your output:

    cursor.execute('describe %s;' % store)
    storeDescription = cursor.fetchall()
    print storeDescription

The "all sorts of data" you referred to in your original post is
obtained in the fetchall() call and then printed in the print statement.
As I said, your output did not come from the execute() call.

As usual, in your original post you didn't include the code that
produces the output that's causing you grief, and you didn't include the
output, either. This information is essential for helping you, and you
have been asked many times before to provide this information.
Persistently asking for help and not providing enough information is, as
has been noted before, a form of rudeness.

--
Carsten Haese
http://informixdb.sourceforge.net




More information about the Python-list mailing list