mxODBC: Getting source table for columns in the cursor.description

Sean sean at activeprime.com
Wed Apr 30 14:43:38 EDT 2003


Quick mxODBC question.  I have a db with two tables, 'accounts' and
'contacts', where both tables have a column named 'phonenumber'.  I'm
pushing an SQL select statement using Egenix's mxODBC along the lines
of "select * from accounts a1 INNER JOIN contacts c1 on a1.<some
column> = c1.<some column>".

Everything works great.  The only problem is when I get the
description from the cursor I have a list of column names without
knowing what table they came from.  Using the above example, I would
have two "phonenumber" columns listed in the description.  Is there a
way to determine which listing came from which table?  I would like to
avoid having to rewrite my SQL statement to specifically list each and
every column selected with "select x as table.x", but I need a way to
know what columns came from which table.  Is there functionality built
into mxODBC to do this that I'm missing?  I've been going through the
API here:

http://www.egenix.com/files/python/mxODBC.html

but without any luck.

-Sean




More information about the Python-list mailing list