The Python docs state that
# Never do this -- insecure!
symbol = 'RHAT'
c.execute("SELECT * FROM stocks WHERE symbol = '%s'" % symbol)
# Do this instead
t = ('RHAT',)
c.execute('SELECT * FROM stocks WHERE symbol=?', t)
print c.fetchone()
I understand that the first option is vulnerable to an SQL injection attack. What I don't understand is why the second option would be more secure. Aren't these identical?