I'm just starting out with psycopg2. I'm trying to pass a timestamp query parameter to an sql query. Unfortunately the constructed query returns nothing, even though it should. The code follows; does anyone see what I'm doing wrong?
date = datetime.now().strftime("%Y-%m-%d") params = [datetime.strptime(date + " 00:00:00", '%Y-%m-%d %H:%M:%S'), datetime.s trptime(date + " 23:59:59", '%Y-%m-%d %H:%M:%S')] print params try: query = """select * from timesheet s where submitted=true and started_at between '%s' and '%s'""" cursor.mogrify(query, params)