I’m trying to send today variable into SQL but it is not working.
import datetime from date today = date.today() stmt = "select agent_email from customer_interaction_fact where to_date(DT) >= + today + ORDER BY CONVERSATION_CREATED_TIME DESC"
Advertisement
Answer
You don’t have to compute today’s date in Python. Just use the PostgreSQL function CURRENT_DATE
:
stmt = "SELECT ... WHERE TO_DATE(DT) >= CURRENT_DATE ..."