[Zope-dev] Using db_connections from Zope products

Jim Penny jpenny@universal-fasteners.com
Wed, 20 Jun 2001 12:18:30 -0400


On Wed, Jun 20, 2001 at 08:54:41AM -0700, Tom Brown wrote:
> I would like to make an SQL query directly from python
> code.  Do I have to make a 
> ZSQL Method dynamically, or is there another way
> without making the class database 
> dependent (i.e. Gadfly, PoPy, etc), utilizing an
> existing db_con?  Suppose I am using the ZPoPy DA and 
> have established a database connection externally. 
> How can I access this database 
> and submit a query from my own class?

You can use an established connection.

If it is ZSQL based, you will have to deal with the results
object. 

A good overview of the results object is
http://www.zope.org/Members/spinwing/ZSQL_Results

You might also look at the somewhat dated
http://www.zope.org/Members/jpenny/Accessing_a_ZSQL_Method_from_an_External_Method

This would work from Script (Python), as well.

Jim Penny 

> 
> Thanks,
> Tom Brown
> altafare@yahoo.com
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>