[PIPython] altro problema tuple / sql

Mariano Di Felice mardif
Mar 12 Apr 2005 17:26:16 CEST


Alberto Lei ha scritto:

> Ciao a tutti,
> ho un problema analogo nel gestire i parametri passati all'execute di 
> MySQLdb tramite tupla: nella sintassi sql ho la necessità di 
> utilizzare i percentuali per formattare le date. Ad esempio:
>
> cur.execute("SELECT DATE_FORMAT(CAMPO_DATA, '%d/%m/%Y') FROM TABELLA 
> WHERE ID = %s", (1180,))
>
> si arrabbia perchè quando incontra il %d del date_format lui si 
> aspetta un intero nella tupla dei valori...
> Qualcuno ha idea di come aggirare il problema?
> Grazie mille.
> Ciao
>
> Alberto Lei
>
>------------------------------------------------------------------------
>
>_______________________________________________
>La mailing list di python.it
>python a lists.python.it
>http://lists.python.it/cgi-bin/mailman/listinfo/python
>  
>
prova a mettere il %%d
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mardif.vcf
Type: text/x-vcard
Size: 274 bytes
Desc: not available
Url : http://list.zope.it/pipermail/python/attachments/20050412/cb819ec1/mardif-0001.vcf


More information about the Python mailing list