diff --git a/app/dao/inbound_sms_dao.py b/app/dao/inbound_sms_dao.py index ba17ddd26..aea4af653 100644 --- a/app/dao/inbound_sms_dao.py +++ b/app/dao/inbound_sms_dao.py @@ -102,7 +102,7 @@ def _delete_inbound_sms(datetime_to_delete_from, query_filter): while number_deleted > 0: _insert_inbound_sms_history(subquery, query_limit=query_limit) - number_deleted = InboundSms.query.filter(InboundSms.id.in_(subquery)).delete(synchronize_session='fetch') + number_deleted = InboundSms.query.filter(InboundSms.id.in_(subquery)).delete(synchronize_session=False) deleted += number_deleted return deleted diff --git a/app/dao/notifications_dao.py b/app/dao/notifications_dao.py index 3b313a0df..fa046145d 100644 --- a/app/dao/notifications_dao.py +++ b/app/dao/notifications_dao.py @@ -377,7 +377,7 @@ def _delete_notifications(notification_type, date_to_delete_from, service_id): Notification.notification_type == notification_type, Notification.service_id == service_id, Notification.created_at < date_to_delete_from, - ).delete() + ).delete(synchronize_session=False) db.session.commit() return deleted