Psycopg2 (curr.execute) 正在返回 NONE python

Psycopg2 (curr.execute) Is returning NONE python

我已经在 psycopg2 中编写了一个脚本来更新我的员工 table,但是更新没有发生,currr.execute 正在返回一个 None 对象。

我的代码

            connm = psycopg2.connect(database="database", user = "user", password = "pass", host = "localhost", port = "5432")
            connm.autocommit = True
            sql = """ UPDATE employee SET name = %s WHERE phone_number = %s"""
            curr = connm.cursor()
            username = "Mike"
            query = "+0123456789"
            abc = curr.execute(sql, (username, query))
            print abc
            connm.commit()
            curr.close()

此 abc 对象正在返回 None。

请帮帮我! 提前致谢!

引用 "Psycopg – PostgreSQL database adapter for Python - execute command":

The method returns None. If a query was executed, the returned values can be retrieved using fetch*() methods

那么,None看起来不错。恭喜:)

已编辑关于无效:

你能在数据库上测试你的查询吗?

my_raw_query=curr.mogrify(sql, (username, query))
print my_raw_query

检查查询是否正常,复制粘贴查询到数据库再检查一次。