[Zope-DB] Combine Result Sets
Charlie Clark
charlie at egenix.com
Fri Sep 23 15:14:47 EDT 2005
On 2005-09-23 at 18:14:40 [+0200], Dale Hirt <dale at sbcltd.com> wrote:
> Hello,
>
> I have been searching both online and in this list's archives. I am still
> a bit stumped however. I have two different ODBC connections to two
> different Caché DB's. They have the exact same structure and column names
> and types. I run a query against each of the connections and get back a
> Shared.DC.ZRDB.Results class in each case.
>
> Has anyone come up with code to combine the results? I would be much
> appreciative. If not, a pointer in the right direction would be helpful.
Hi Dale,
if I understand you correctly, you want to be able to UNION the two queries.
If that is the case then I'd be tempted to do this on the database side if
possible. Of course, Zope does make it easy to integrate the two result sets
using a PythonScript.
As you can interate through the objects you can easily create two lists and
combine them:
results = list(context.SQL1())
results += list(context.SQL2())
If performance is an issue then you should look at combining the results on
the db side.
Charlie
--
Charlie Clark
eGenix.com
Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the Zope-DB
mailing list