我基本上是在尝试完成回答者在此处指出的内容:psycopg2 cursor.execute() with SQL query parameter cause syntax error
我的声明是:
cursor.execute('SELECT %s FROM %s WHERE %s = %s' % (pkey,table,field, "%s"), (value))
但是当我运行它时,我得到了错误:
---> 89 cur.execute('SELECT %s FROM %s WHERE %s = %s' % (pkey,table,field, "%s"), (value))
90 res=cur.fetchone()
91 if res==None:
TypeError: not all arguments converted during string formatting