Confusion between prepared statement and parameterized query in Python
As far as I understand, prepared statements are (mainly) a database feature that allows you to separate parameters from the code that uses such parameters. Example: PREPARE fooplan (int, text, bool, numeric) AS INSERT INTO foo VALUES($1, $2, $3, $4); EXECUTE fooplan(1, 'Hunter Valley', 't', 200.00); A parameterized query substitutes the manual string interpolation, so instead of doing cursor.execute("SELECT FROM tablename WHERE fieldname = %s" % value) we can do cursor.execute("SELECT FROM tablename WHERE fieldname = %s", [value]) Now, it seems that prepared statements are, for the most part,