I need to allow the creation of database users/roles through a web application that uses Python and SQLAlchemy in the backend. To do that i'm using something like: sql = 'CREATE USER :username WITH PASSWORD asswd' sql_data = { "username": "the_user_name", "passwd": "the_password", } request.db.execute(sql, sql_data) But the SQL created by this query is: CREATE USER 'the_user_name' WITH PASSWORD 'the_password' and what I need is: CREATE USER "the_user_name" WITH PASSWORD 'the_password' with the username properly escaped. Is there a way that SQLAlchemy can handle this or should I create the string manually? If so, how can I escape the user input name? Continue reading...