You misplaced your %
What you're doing now is:
cursor.execute("[snip]") % time_now
So you're applying time_now
on the result of cursor.execute
What you want is use the %
with the string, like so:
cursor.execute("[snip]" % time_now)
BUT don't do this, you should use:
cursor.execute("Select * from SUBSCRIPTION_DETAILS where Alert_time=%s", (time_now,))
Note that here, we're passing time_now
as a second parameter, instead of using the %
operator. This will make sure the query is properly sanitized, to prevent SQL injection attacks.
The (somewhat ugly) trailing ,
is needed to make sure the second argument is a tuple.