I am getting Error when trying to execute this query or when it works it does not take the value of date in account. Can someone tell me how to write this correctly?I pass value of date when i call the function.
def get_Value(connection,date):
query = """SELECT *
FROM Tests
WHERE Date > 'date';"""
What your query does is comparing the value in your Date
column with the string 'date'
; the parameter you're passing to the method is not being considered at all.
What you need to do is concatenating your query with the parameter you pass, like
def get_Value(connection,date):
query = """SELECT *
FROM Tests
WHERE Date > '{}';""".format(date)
This will make Python replace {}
with the value of the date
variable at runtime.