[Zope] Re: formatting tuple to feed to mysql

Wolfram Kraus kraus at hagen-partner.de
Tue May 10 02:36:14 EDT 2005


David Siedband wrote:
> I'm have a tuple that I want to pass to a zSQL query to so I can based 
> on items in the tuple.  I get the sequence from a zSQL query that 
> selects a single field, and I'm postprocessing it with the following:
> 
> <dtml-let SelectedIDs="[ai[0] for ai in 
> queries.selectDOdocIDs().tuples()]">
> 
> Which puts the sequence in brackets like this:
> 
> [211, 873, 515, 516, 589]
> 
> but mysql seems to want them in parenthesis... because when I try this
> 
> select ThemeWords.*
> from DocThemes, ThemeWords
> where DocThemes.DocID in <dtml-var SelectedIDs>
> and DocThemes.ThemeID = ThemeWords.ID
> 
> I get a KeyError.
> 
> Also, is it possible to pass a list using dtml-sqlvar?
> 
> thanks
> -- 
> David
> 
Use "dtml-sqltest" with the attribute "multiple":
http://www.plope.com/Books/2_7Edition/RelationalDatabases.stx#2-67

HTH,
Wolfram



More information about the Zope mailing list