Mapping Column Names to results using DBI

Gordon McMillan gmcm at hypernet.com
Wed Jan 19 23:30:21 EST 2000


Timothy Grant wrote:

> Aahz Maruch wrote:
>  
> > Try "SELECT x, y, z" instead of "SELECT *".
> 
> I knew it couldn't be that simple...
> 
> I must be missing something

DBs return the columns in the order requested. So you will 
always get tuples of (x,y,z).

"Select *" is like "from module import *" - something you 
should really only do in interactive mode.

I'll agree that this creates a distasteful coupling between the 
SQL code and the Python, but performance makes it more 
palatable.



- Gordon




More information about the Python-list mailing list