retrieve data from 2 database
Steve Holden
steve at holdenweb.com
Thu Jul 28 16:33:15 EDT 2005
crespoh wrote:
> Hi,
>
> How do I select data from two tables from two different databases and
> compare them? using dbi,odbc
>
Well, a lot depends on the database. If it's two Access .mdb files, for
example, or two different databases in a single SQL Server instance,
sometimes you can use SQL statements that cross-refer. Not possible with
ODBC, though, I fear.
In that case, we have to hope that the datasets are small enough to hold
in memory, as Python data structures, and then operate on them as Python
sets or some such. The DB API delivers the results of queries as lists
of tuples, each tuple representing a row, but of course they can easily
be transformed into other Python objects with more convenient properties
to join the two sets together.
Much then depends on how you want to join the two sets.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list