I'm trying to execute insert
statements from Python to PostgreSQL using the pgdb module.
I see the documentation says:
cursor.executemany(query, list of params)
# Execute a query many times, binding each param dictionary
# from the list.
So I'm trying things like:
>>> insert = "insert into foo (name, number) values (?,?);"
>>> params = [{ 'name': 'John', 'number': 123 }, { 'name': 'Jack', 'number': 234 }]
>>> cursor.executemany(insert, params)
This is giving me a error, pointing at the ?
. What is the correct syntax for this sort of parameterized query? Also, if this is in the documentation, where do I find it?