This is different from Using a SQLAlchemy Integer field to create a timedelta object for comparison because that thread is asking which function to use when adding time. The function was found for their version of MySQL, however, the followup edits of the user digress from their original question and do not answer this question.
I'm using MySQL. I want to use a function called timestampadd. https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timestampadd Its first parameter is the unit of time that I'm adding, EG: MINUTE, HOUR, DAY.
When writing the SQLAlchemy query, I can't do something like
datetime_now = datetime.datetime.utcnow()
Item.query.filter(Item.created <= sqlalchemy.func.timestampadd(MINUTE, 1, datetime_now))
If I do this, I'll get an undefined error for
MINUTE. I also tried:
Item.query.filter(Item.created <= sqlalchemy.func.timestampadd('MINUTE', 1, datetime_now))
But this will generate the timestampadd call with quotes around the unit, which causes a MySQL error. How would I remove the quotes around
MINUTE in the generated query?