psycopg2 TypeError: not all arguments converted during string formatting

前端 未结 5 2045
[愿得一人]
[愿得一人] 2020-12-15 17:37

I\'m trying execute a simple query, but getting this error no matter how I pass the parameters.

Here is the query (I\'m using Trac db object to connect to a DB):

5条回答
  •  萌比男神i
    2020-12-15 17:47

    In my case I didn't realize that you had to pass a tuple to cursor.execute. I had this:

    cursor.execute(query, (id))
    

    But I needed to pass a tuple instead

    cursor.execute(query, (id,))
    

提交回复
热议问题