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