Answer the question
In order to leave comments, you need to log in
How to submit a deletion request?
Hello!
Guys, I'm stupid, I've been sitting for several hours, I can't drink everything, how can I delete all the records that fall under the range?
There is a jobs table in this table there is an add_date column (type INT) I store the date in UNIX, I want to filter on this column and delete all records that are more than 30 days old.
I make a request like this:
Jobs.query.filter(Jobs.add_date < (int(time.time()) - 60 * 60 * 24 * 30)).delete(synchronize_session=False)
Jobs.query.filter(Jobs.add_date < (int(time.time()) - 60 * 60 * 24 * 30)).delete()
db.session.commit()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question