[Zope] MySQL queries in Python
John Barham
jbarham at gmail.com
Tue Aug 1 15:05:15 EDT 2006
> import MySQLdb
This is probably redundant.
> import string
>
> request = container.REQUEST
> session = request.SESSION
>
> result = (context.aq_parent).selects.select_from_table()
>
> print result
Assuming you want the person's name printed, change this line to:
print result[0].name
Think of the result from a ZSQL query as a list/iterator over the
resulting rows. In your case I'm assuming there is only one person
row w/ the given id, so there is only one row in the result, but you
still have to explicitly de-reference it w/ its index.
HTH,
John
More information about the Zope
mailing list