I have a datetime list lets say datelist which I later convert into string.
I want to run following sql query : select * from test_table_20220401 where date < '2022-04-01 00:00:00' and date1 > '20220401'
for multiple dates. So I need to replace the 'dates' string in the query with python variables from the datelist that I have created. I can resolve for this when I have to replace a string from a query with only one python variable. Please refer the below code:
for in datelist:
query = "select * from test_table where date1 > {}".format(i)
Please let me know. Thank you.