As stated in the official documentation: "Only these query values should be connected using this method: it should not be used to combine the names of tables or fields into a query. If you need to dynamically generate a SQL query (for example, choosing a table name dynamically) you can use the tools provided by the psycopg2.sql module. "
It has the following syntax:
from psycopg2 import sql
tbl = 'table_name'
rows = [{'this':x, 'that': x+1} for x in range(10)]
cur.execute(
sql.SQL("INSERT INTO {} VALUES (%(this)s, %(that)s);"""")
.format(sql.Identifier(tbl)), rows)
http://initd.org/psycopg/docs/sql.html#module-psycopg2.sql