[Zope] connet to MS-SQL database with ython script from with in zope
Tim Hicks
tim@sitefusion.co.uk
Mon, 18 Feb 2002 16:41:27 -0000
----- Original Message -----
From: <mbagepll@memphis.edu>
To: "Jim Washington" <jwashin@vt.edu>; <zope@zope.org>
Sent: Monday, February 18, 2002 4:23 PM
Subject: Re: [Zope] connet to MS-SQL database with ython script from with in
zope
> Hi Jim,
>
> Thank you very much. But i want to use Python scripts to write the sql
> queries and not ZSQL methods. I have my ZODBCA installed and have
> created a obdc connection to the MS-SQL database. Can i use this (i
> mean the connection object) some how in the python script and query the
> database.
I haven't followed the rest of this thread, so tell me if I'm way off the
mark.
I do this by having a ZSQL Method (say sqlMethod) that simply contains
<dtml-var the_sql> and has one argument (the_sql). I then build my sql
statement within my python script and execute it like,
#generate the sql statement
results = container.sqlMethod(the_sql=generated_sql)
#do stuff with the results
I think there's a howto on www.zope.org somewhere, and a few previous posts
on this list too. Have a scout around.
I'm sure there must be security issues to consider as well...
hth
tim