Weird SQLAlchemy error passing a query with python

I ran into an issue one time where a query which worked fine on dbeaver through a weird error when a python script that ran it failed on the remote server.


Error message was something along these lines: TypeError: 'dict' object does not support indexing.


After some digging I found the issue had to do with my use % in several case statements. Apparently % is not parsed as expected by SQLAlchemy and the fix was just to double the sign ie.%%


As things stand I don’t have a really good explanation why so when i get more knowledgeable I’ll update!


Sources:




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Google Gemini updates: Flash 1.5, Gemma 2 and Project Astra
  • Displaying External Posts on Your al-folio Blog
  • Can Machine Learning Help Predict Heart Disease? A Data Science Exploration
  • Predicting House Prices; MLR vs RFR
  • Predicting House Prices; SVC vs Random Forest