getting the field names from a resultset on Windows with mxODBC

David Bolen db3l at fitlinxx.com
Fri Mar 9 20:55:52 EST 2001


"Scott Hathaway" <slhath at home.com.nospam> writes:

> I am using mxODBC for Windows.  When I do a query, how can I get the names
> of the fields that the resultset returns (without parsing the SQL myself or
> having the user supply them)?

Use <cursor>.description - it's a list of tuples corresponding to your
fields that map to each element of the result set you are getting
back.  It includes name and type information and some other stuff.
This is part of the standard Python DB-API, and is covered in both the
DB-API and mxODBC-specific documentation included with mxODBC.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list