I have this code
myquery = '''SELECT * from users
where id = 10 and
city = 20 and
state = 30'''
I want to replace those with three variables like
var_id = bla
var_city = bla
var_state = bla
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
paramsargument toraw():paramsis a list of parameters. You’ll use%splaceholders in the query string (regardless of your database engine); they’ll be replaced with parameters from the params list.Important note from Django docs: