I am using hand crafted SQL to fetch data from a PG database, using SqlAlchemy. I am trying a query which contains the SQL like operator \'%\' and that seems to throw SqlAlc
It seems like your problem may be related to this bug.
In which case, you should triple-escape as a workaround.