UPDATE DB列 - Python ResourceClosedError

时间:2016-09-14 20:14:42

标签: python postgresql sqlalchemy sql-update

我正在尝试使用以下python代码

更新Postgres表(Table1)中的列
for i in range(0,len(df)):
        QUERY=""" UPDATE "Table1" SET "var"='%s' WHERE "Table"."id"='%s' """
         % (df['sum'][i], df['id'][i])
        pd.read_sql_query(QUERY,con=engine)

它抛出以下错误消息。

ResourceClosedError: This result object does not return rows. It has been  closed automatically.

能告诉我如何解决这个问题吗?

0 个答案:

没有答案