I am trying to do multiple mysql queries to get monthly data from a table, using a for/while loop using a set of dates.
For ex, I have a list of dates as :
a = [
(2022-01-01, 2022-01-31),
(2022-02-01, 2022-02-28),
(2022-03-01, 2022-03-31),
...,
(2022-12-01, 2022-12-31)
]
I would like to go through the dates so that I don't have to query 12 times manually. But I get sql compilation error: invalid identifier A:
for i in range(12):
sql_query = select *
from table
where date between a[i][i] and a[i][i+1];
and pass this query to snowflake db