How to use parameter values in embedded sql query in python? -
i getting error when trying execute query or when works not take value of date in account. can tell me how write correctly?i pass value of date when call function.
def get_value(connection,date): query = """select * tests date > 'date';"""
what query comparing value in date
column string 'date'
; parameter you're passing method not being considered @ all.
what need concatenating query parameter pass, like
def get_value(connection,date): query = """select * tests date > '{}';""".format(date)
this make python replace {}
value of date
variable @ runtime.
Comments
Post a Comment