Skip to content
Home » Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing

Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing

To solve Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing error follow below methods.

ERROR LOG

Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing

How to solve Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing ?

You have to give %%, Because % is used as string formatting in Python, when you write a single %, it assumes that you are going to replace some value with this.

So, whenever you wish to put a single % in a string with a query, always put a double %.

Solution 2:

SQLAlchemy has a text() function for wrapping text which appears to correctly escape the SQL,

res = executeSql(sqlalchemy.text(sql))

Hope the above solution works.

Also read :

AttributeError: ‘method_descriptor’ object has no attribute ‘today’ Python Django