Is a SQLAlchemy query vulnerable to injection attacks?

The underlying db-api library for whatever database you’re using (sqlite3, psycopg2, etc.) escapes parameters. SQLAlchemy simply passes the statement and parameters to execute, the driver does whatever is needed. Assuming you are not writing raw SQL that includes parameters yourself, you are not vulnerable to injection. Your example is not vulnerable to injection.

Leave a Comment