I am using SQLAlchemy to connect to different databases in Python, but not with the ORM support as this cannot be implemented due to several reasons.
Mainly I do build a
In cases where one must explicitly escape a string, and the standard tools don't align with the requirement, you can ask SQLAlchemy
to escape using an engine's dialect.
import sqlalchemy
engine = sqlalchemy.create_engine(...)
sqlalchemy.String('').literal_processor(dialect=engine.dialect)(value="untrusted value")
In my case, I needed to dynamically create a database (sqlalchemy-utils
has this functionality but it failed in my case) according to user input.