[Tutor] Trying to use MySQLdb.cursor

Alan Gauld alan.gauld at freenet.co.uk
Fri Mar 25 21:11:02 CET 2005


> below to print the data returned from my query, but I would like to
make
> labels at the top of the columns. How do I do this dynamically?

You shouldn't, it makes your code very vulnarable to changes in the
database!
Its the same principle as using 'select * from...', a bad idea in
production code. And if you know which columns you are selecting you
by definition know what labels to use.

And another reason why its a bsad idea is that databvase columns often
have weird abbreviated names that you don't want to expose users to.

Alan G.



More information about the Tutor mailing list