On 12/11/06, Jose Soares <[EMAIL PROTECTED]> wrote: > > Hi all, > > I need some help with in_ function.... > > (Pdb) print codice > ['', '62714', '62601', '62602', '62612', '62614', '62603', '62610'] > (Pdb) print type(codice) > <type 'list'> > (Pdb) print select([Attivita.c.cod_specie], > Attivita.c.codice.in_(tuple(codice))) > SELECT attivita.cod_specie > FROM attivita > WHERE attivita.codice = %(attivita_codice)s
The in_() function expects to receive the list of values as multiple parameters. If it receives only one parameter, it assumes that that one parameter is a single value for the "IN" operation -- that is, you said something like "Attivita.c.codice.in_('62601')". So change that in_() call to "Attivita.c.codice.in_(*tuple(codice))" (or even just "Attivita.c.codice.in_(*codice)" for simplicity's sake) and you should get the expected results. -- Robin Munn [EMAIL PROTECTED] GPG key 0x4543D577 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---