sakuto29 / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Let various cursor methods return a namedtuple #230

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
An enhancement request. 

I don't know if something like that is even possible, but I think that it would 
be quite helpful if various cursor methods like columns, tables etc, returned a 
namedtuple.

with regards,
Panos

Original issue reported on code.google.com by pmav99@gmail.com on 13 Jan 2012 at 11:37

GoogleCodeExporter commented 8 years ago
The ones you mentioned return Row objects, so you can already use names.  Look 
at the Cursor.columns example (http://code.google.com/p/pyodbc/wiki/Cursor)

# columns in table x
for row in cursor.columns(table='x'):
    print row.column_name

The results are the same as if you performed a SQL SELECT for the given columns.

Original comment by mkleehammer on 17 Jan 2012 at 12:59

GoogleCodeExporter commented 8 years ago
Ah! Marvelous! Thank you!

Original comment by pmav99@gmail.com on 17 Jan 2012 at 2:36