Being new to Django, sometimes I face interesting problems. If it is very late and you are very tired, It may not always be easy to see the problem looking at the displayed error message like this int’ object has no attribute ‘keys’ error message I got in cursor.execute() method 🙂
This error was thrown on the line below:
cursor.execute(“select col1,col2 from table_name where col3 = %s”, integer_value)
The reason I got this error was that I had provided the integer directly as an argument but according to the documentation the second argument must be a sequence or mapping. Below solved the issue:
cursor.execute(“select col1,col2 from table_name where col3 = %s”, [integer_value])
Hope this helps.