Generate partition filter from time interval

I’m using several DBs that work with partition (Athena, Presto, Impala, …). The classical partition scheme we use is by YEAR, MONTH, DAY.

What I need to do is to generate these filters from the date range variables.
E.g.
A query with
start>='2020-03-22' AND end<'2020-05-17'

will become
start>='2020-03-22' AND end<'2020-05-17' AND YEAR=2020 AND ((MONTH = 3 AND DAY >= 22) OR MONTH=4 OR (MONTH=5 AND DAY<=17 ))

Is this something that would be possible to add to redash? Without the partition filters, queries take way too long to be usable.