[Zope] Question about SQL queries in Python

ed colmar ecolmar@uswest.net
Mon, 26 Feb 2001 08:58:44 -0700


I've been trying to accomplish a similar task...   SQL calls from within
python using the excellent PoPy and ZPoPy modules.

Will this work in a external method?  Or equally well in a product?

Thanks all!  zope hackers rule!

-e-

----- Original Message -----
From: "Kevin Teague" <kevin@bud.ca>
To: "alankirk" <alankirk@genie.co.uk>; " Zope" <zope@zope.org>
Sent: Sunday, February 25, 2001 4:25 AM
Subject: Re: [Zope] Question about MySQL queries in Python Scripts


> > I've written a few python scripts that use some sql queries to a mysql
> > database. I have a script that can access the database and get
information ok
> > but i have a sript that tries to insert data to the database, but when i
try
> > to run it, i get a zope error that mentions Unauthorized: query.
> >
> > Does anyone know why this is and how to get round it?
>
> Hmm, some more information about your script or the traceback in your
error
> message would be helpful. If I wanted to create SQL queries in a python
> script, I would create a MySQL DB connection in Zope, then a simple Z SQL
> Method that took a single arguement as a string, like this:
>
> Params: query:string
> Method: <dtml-var query>
>
> Then I'd only allow Manager access to this Z SQL Method and then give the
> python script a proxy role so that it could access the Z SQL Method. Then
> call that Z SQL Method from the Python Script perhaps like this:
>
> container['zsqlmethodid'](query='SELECT * FROM your_table')
>
> Kevin Teague
> http://www.bud.ca
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>