psycopg2 where 子句的多个参数
multiple parameters for psycopg2 where clause
我正在尝试 运行 executemany
命令,但我无法让我的 table 更新。当我的 WHERE 子句中有一个参数时,我能够让它工作,但现在我有多个参数,table 无法更新。
cur.executemany("""UPDATE orders SET (invested_amount, ex_order_id, \
time_acknowledged, execution_code) = \
(%(invested_amount)s, %(instruct_id)s, current_timestamp, \
%(execution_code)s) WHERE loan_id = %(loan_id)s and \
requested_amount = %(requested_amount)s and execution_code = NULL""",
order_list)
应该是:
execution_code IS NULL
-- ^^
我正在尝试 运行 executemany
命令,但我无法让我的 table 更新。当我的 WHERE 子句中有一个参数时,我能够让它工作,但现在我有多个参数,table 无法更新。
cur.executemany("""UPDATE orders SET (invested_amount, ex_order_id, \
time_acknowledged, execution_code) = \
(%(invested_amount)s, %(instruct_id)s, current_timestamp, \
%(execution_code)s) WHERE loan_id = %(loan_id)s and \
requested_amount = %(requested_amount)s and execution_code = NULL""",
order_list)
应该是:
execution_code IS NULL
-- ^^