[Tutor] Trying to use MySQLdb.cursor
vicki at stanfield.net
Sat Mar 26 02:57:45 CET 2005
>> below to print the data returned from my query, but I would like to
>> 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
> 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.
I am just trying to write code to demonstrate this capability in Python.
If I am actually in a position where I have access to the database schema,
I would not do so. I agree with your comments.
More information about the Tutor