psycopg2 equivalent of mysqldb.escape_string?

后端 未结 5 590
迷失自我
迷失自我 2020-12-10 23:53

I\'m passing some values into a postgres character field using psycopg2 in Python. Some of the string values contain periods, slashes, quotes etc.

With MySQL I\'d ju

5条回答
  •  死守一世寂寞
    2020-12-11 00:36

    Like piro said, escaping is automatic. But there's a method to also return the full sql escaped by psycopg2 using cursor.mogrify(sql, [params])

提交回复
热议问题