Re: psycopg2 gets confused by % characters and strict pyformat mode
Alejandro Dubrovsky <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2008-09-10 at 07:40 -0700, Chris Cogdon wrote:
> why not do something like this:
>
> cursor.execute ( "select * from t where s like %(match)s and k = %
> (something)s",
> { 'match': '%whatever%', 'something':'else' } )
>
>
Yes, that is the correct solution, but only if the script is forming the
query string from scratch, or writes an SQL parser to modify it.