News for hackers. Stuff that matters.
Re:PostgreSQL 11.3 and 10.8 by mitch3x3 on Thursday May 09, 2019 @12:37PM (#19869754)
Pyscopg2 + Raw SQL inside of “”” “”” strings, and use %(foo)s as a parameter placeholder. Cur.execute will accept a parameter dictionary like:

cur.execute(query, {‘foo’: bar})

Passing values directly into cur.execute is the best way to prevent SQL injection as well since it will sanitize the input params upon running

There are no comments on this comment yet.