close

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

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

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

Today I get the following error Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing in python.

How To Solve Strange SQLAlchemy error message: TypeError: ‘dict’ object does not support indexing Error ?

  1. How To Solve Strange SQLAlchemy error message: TypeError: 'dict' object does not support indexing Error ?

    To Solve Strange SQLAlchemy error message: TypeError: 'dict' object does not support indexing Error You have to give %% to use it as % because % in python is use as string formatting so when you write single % its assume that you are going to replace some value with this.

  2. 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 You have to give %% to use it as % because % in python is use as string formatting so when you write single % its assume that you are going to replace some value with this.

Solution 1

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

I.e.

res = executeSql(sqlalchemy.text(sql))

should work for you and save you from having to do the manual escaping.

Solution 2


You have to give %% to use it as % because % in python is use as string formatting so when you write single % its assume that you are going to replace some value with this.

So when you want to place single % in string with query allways place double %.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read