psycopg2 not actually inserting data

前端 未结 2 1963
我寻月下人不归
我寻月下人不归 2020-12-14 05:18

I need to insert JSON data from tornado to postgres, so here\'s test like this:

from psycopg2 import connect

conn = connect(\"user=\'pguser\' host=\'localho         


        
2条回答
  •  猫巷女王i
    2020-12-14 06:02

    You didn't commit the transaction.

    Psycopg2 opens a transaction automatically, and you must tell it to commit in order to make the data visible to other sessions.

    See the psycopg2 FAQ and the connection.commit() method.

提交回复
热议问题