[Zope] Re: Calling a SQL method from python and storing the results

Mike Jakowlew mjakowlew at gmail.com
Thu Nov 24 15:28:16 EST 2005


Thanks all, I figured it out:

## GET last entry in db and obtain ID
## Find_Last_ID is my ZSQL method
## the [0][0] part is record_number/record_item repectively
## I only have one record in this method's return so I use [0] [0]

get_last_id = container.Find_Last_ID().tuples()[0][0]


On 11/24/05, Mike Jakowlew <mjakowlew at gmail.com> wrote:
>
> Here is what I need to accomplish:
>
> I need to call a Z-SQL method from within python and store the result in a
> variable in python. I know this could probably be done easier with ZPT's or
> DTML, however the program that I've written does many things and depends on
> this particular variable for the majority of the program.
>
> My overall program:
>
> Uploads a File (Working)
> Write an entry to a MS SQL DB (Working)
> Send an Email to alert user of upload (Working)
>
> in this particular case all I need is the id of the last row in the db
> before the e-mail is sent out. The e-mail itself sends a link that calls
> another SQL method with ID as the parameter passed.
>
> I've tried to use the container.id method, but that just returns the name
> of the Z-SQL method.
>
> Thanks in advance,
> mjakowlew
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20051124/6c58f5aa/attachment.htm


More information about the Zope mailing list