Database bind variables?

David M. Cook davecook at
Sat Nov 22 09:57:48 CET 2003

In article <ba6a8303.0311212235.18c95df6 at>, Andrew Fabbro

> I haven't found a way to do this yet with pygresql (or should I be
> using something else?  if only the docs where there...;)

All the postgresql adaptors I'm aware of use "pyformat" interpolation, which
is similar to python's dictionary string interpolation, e.g.

cursor.execute("select * from baz where foo=%(foo)s", {'foo' : 1234})

This does any necessary quoting for you.

Dave Cook

More information about the Python-list mailing list