Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: DB

Querying many DBs from one set of SQL methods?

 

 

Zope db RSS feed   Index | Next | Previous | View Threaded


stuart.nicholson at wirelessdatanz

Sep 16, 2001, 9:49 PM

Post #1 of 5 (735 views)
Permalink
Querying many DBs from one set of SQL methods?

The itch: I need to have a single set of Z SQL methods that can be run against multiple databases as part of a common web interface driven by data held in different client's
databases.

A problem: However when defining a Z SQL method you are required to select an existing Zope Database Connection instance that the SQL method will run against.

A scatch?: To me (being something of a Zope novice), it would appear to scratch my itch I have to 'copy and paste' into different folders (say one per client), duplicating my
common SQL methods, defining the appropriate DB Connection in each folder and then changing each duplicated SQL method to point to that connection. This seems a rather
inelegant solution.

Is there a better way?: I haven't tried but imagine I can programatically change the DB Connection properties prior to running each request. Is this a viable solution? Will
this work with multiple clients running the same query for example? Can anybody suggest a better solution?

Thanks in advance,

Stuart Nicholson
Software Engineer
Wireless Data


----------------------------------------------------------------------
The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorised to receive it. It may
contain confidential or legally privileged information.
If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is
strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system.
Wirelessdata Ltd is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt.
----------------------------------------------------------------------


dieter at handshake

Sep 17, 2001, 11:54 AM

Post #2 of 5 (703 views)
Permalink
Re: Querying many DBs from one set of SQL methods? [In reply to]

Stuart Nicholson writes:
> The itch: I need to have a single set of Z SQL methods that can be run against multiple databases as part of a common web interface driven by data held in different client's
> databases.
A few time ago, someone else had a similar problem and I suggested
a ZClass solution. Please search the mailing list archives
(zope and zope-dev, not zope-db, as it was before the "zope-db"
times) to locate the thread.


Dieter


andym at ActiveState

Sep 17, 2001, 12:31 PM

Post #3 of 5 (690 views)
Permalink
Re: Querying many DBs from one set of SQL methods? [In reply to]

A hack I use to do the same thing:

http://aspn.activestate.com/ASPN/Mail/Message/536907

Cheers.
--
Andy McKay.


----- Original Message -----
From: "Stuart Nicholson" <stuart.nicholson [at] wirelessdatanz>
To: <zope-db [at] zope>
Sent: Sunday, September 16, 2001 9:49 PM
Subject: [Zope-DB] Querying many DBs from one set of SQL methods?


> The itch: I need to have a single set of Z SQL methods that can be run
against multiple databases as part of a common web interface driven by data
held in different client's
> databases.
>
> A problem: However when defining a Z SQL method you are required to select
an existing Zope Database Connection instance that the SQL method will run
against.
>
> A scatch?: To me (being something of a Zope novice), it would appear to
scratch my itch I have to 'copy and paste' into different folders (say one
per client), duplicating my
> common SQL methods, defining the appropriate DB Connection in each folder
and then changing each duplicated SQL method to point to that connection.
This seems a rather
> inelegant solution.
>
> Is there a better way?: I haven't tried but imagine I can programatically
change the DB Connection properties prior to running each request. Is this a
viable solution? Will
> this work with multiple clients running the same query for example? Can
anybody suggest a better solution?
>
> Thanks in advance,
>
> Stuart Nicholson
> Software Engineer
> Wireless Data
>
>
> ----------------------------------------------------------------------
> The information contained in this communication is intended solely for the
use of the individual or entity to whom it is addressed and others
authorised to receive it. It may
> contain confidential or legally privileged information.
> If you are not the intended recipient you are hereby notified that any
disclosure, copying, distribution or taking any action in reliance on the
contents of this information is
> strictly prohibited and may be unlawful.
> If you have received this communication in error, please notify us
immediately by responding to this email and then delete it from your system.
> Wirelessdata Ltd is neither liable for the proper and complete
transmission of the information contained in this communication nor for any
delay in its receipt.
> ----------------------------------------------------------------------
>
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB [at] zope
> http://lists.zope.org/mailman/listinfo/zope-db
>


matt at zope

Sep 18, 2001, 4:16 AM

Post #4 of 5 (690 views)
Permalink
Re: Querying many DBs from one set of SQL methods? [In reply to]

on 9/17/01 12:49 AM, Stuart Nicholson at stuart.nicholson [at] wirelessdatanz
wrote:

> The itch: I need to have a single set of Z SQL methods that can be run against
> multiple databases as part of a common web interface driven by data held in
> different client's
> databases.
>
> A problem: However when defining a Z SQL method you are required to select an
> existing Zope Database Connection instance that the SQL method will run
> against.
>
> A scatch?: To me (being something of a Zope novice), it would appear to
> scratch my itch I have to 'copy and paste' into different folders (say one per
> client), duplicating my
> common SQL methods, defining the appropriate DB Connection in each folder and
> then changing each duplicated SQL method to point to that connection. This
> seems a rather
> inelegant solution.
>
> Is there a better way?: I haven't tried but imagine I can programatically
> change the DB Connection properties prior to running each request. Is this a
> viable solution? Will
> this work with multiple clients running the same query for example? Can
> anybody suggest a better solution?
>
> Thanks in advance,

There's not a better way defined in any API.

What you *could* do is from a python external method (or maybe a python
script; I dont know if the security machinery would let you though) is grab
the SQL method, and grab the connection, and splice the connection into the
method manually. As long as you do this from an external method, and don't
commit the changes (ie set the _p_changed flag) on the SQL method, it
shouldn't be written back out to the ZODB.


tjenkins at devis

Sep 18, 2001, 5:37 AM

Post #5 of 5 (706 views)
Permalink
Re: Querying many DBs from one set of SQL methods? [In reply to]

We use the Z Forwarding Database Adapter to allow one set of ZSQL
methods to run queries against two different databases.

http://www.zope.org/Members/shai/ZForwardingDA


Stuart Nicholson wrote:
> The itch: I need to have a single set of Z SQL methods that can be run against multiple databases as part of a common web interface driven by data held in different client's
> databases.
>
> A problem: However when defining a Z SQL method you are required to select an existing Zope Database Connection instance that the SQL method will run against.
>
> A scatch?: To me (being something of a Zope novice), it would appear to scratch my itch I have to 'copy and paste' into different folders (say one per client), duplicating my
> common SQL methods, defining the appropriate DB Connection in each folder and then changing each duplicated SQL method to point to that connection. This seems a rather
> inelegant solution.
>
> Is there a better way?: I haven't tried but imagine I can programatically change the DB Connection properties prior to running each request. Is this a viable solution? Will
> this work with multiple clients running the same query for example? Can anybody suggest a better solution?
>
> Thanks in advance,
>
> Stuart Nicholson
> Software Engineer
> Wireless Data
>
>
> ----------------------------------------------------------------------
> The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorised to receive it. It may
> contain confidential or legally privileged information.
> If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is
> strictly prohibited and may be unlawful.
> If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system.
> Wirelessdata Ltd is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt.
> ----------------------------------------------------------------------
>
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB [at] zope
> http://lists.zope.org/mailman/listinfo/zope-db
>



--
Tom Jenkins
devIS - Development Infostructure
http://www.devis.com

Zope db RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.