Re: retrieve data from 2 database



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/

.



Relevant Pages

  • [ANNOUNCE] pyswarm 0.7.0 released - MDD for Python & PostgreSQL
    ... pyswarm 0.7.0 released - MDD for Python & PostgreSQL ... Generated Scripts for Installation of Python Packages and PostgreSQL Databases ...
    (comp.lang.python.announce)
  • Re: About Databases...
    ... > I am still quite a newbie with Python (I intensely use wxPython, ... I know almost NOTHING about databases ... I'm talking about SQL. ...
    (comp.lang.python)
  • Re: Database bind variables?
    ... >Python + Postgres. ... >databases in python is proving more challenging than writing the code ... This is all the documentation I've needed so far. ...
    (comp.lang.python)
  • Re: very large dictionary
    ... the language's internal affairs that much. ... It's not Python here. ... this is not a matter of Python. ... I would have sugested to use databases in order to manipulate ...
    (comp.lang.python)
  • RE: SUSPECT: Re: Python, xml, databases, ...
    ... SQLite is easier to embed since you don't need to install anything ... but I'm not sure how it handles large databases (let's say ... Subject: SUSPECT: Re: Python, xml, databases, ... ... >> about MySQL and PostgreSQL, but i think they are only for servers, no ...
    (comp.lang.python)