python & mysql probelm

Michael mogmios at mlug.missouri.edu
Wed Mar 31 13:44:27 CEST 2004


> But why not use a genuine parametrized query:
>
> cursor.execute("select * from projects where projectid "
>                "between %s and %s", (id1, id2))
>
> Especially if you need to execute the same query several times with 
> changing parameters this is faster as far as I know, because the query 
> is prepared once. 

Really? I have wondered what the difference was. Is there any other 
difference in doing it this way rather than with string substitution?




More information about the Python-list mailing list