during the last month i've dedicated myself to the study of Flask, a python framework for building web application.  Following different tutorials i've found online, I've discovered SQLAlchemy.   To be honest, i find it complicated and not really useful since i have a pretty good knowledge of SQL language.   What i want to understand is if there is any major gain in using ORM like SQLAlchemy that i'm missing (maybe some security issue in using pure sql that i don't know about?).  Also, i would appreciate if you could advice me of what's the best python library for working with pure SQL queries.
For some of the apps I've developed (then proceeded to forget about), I've been writing plain SQL, primarily for MySQL.  Though I have used ORMs in python like , I didn't stick with them for long.  Usually it was either the documentation or complexity (from my point of view) holding me back.  I see it like this: use an ORM for portability, plain SQL if it's just going to be using one type of database. I'm really looking for advice on when to use an ORM or SQL when developing an app that needs database support.  Thinking about it, it would be far better to just use a lightweight wrapper to handle database inconsistencies vs. using an ORM.
How do I check if a number is a palindrome?  Any language. Any algorithm. (except the algorithm of making the number a string and then reversing the string).