def clear_expired():
    """Utility function that deletes all expired rows.
    """
    now = get_current_datetime()

    CachedSnapshotImage.query.filter(
        CachedSnapshotImage.expiration_date < now
    ).delete()

    db.session.commit()
dataset/ETHPy150Open dropbox/changes/changes/lib/snapshot_garbage_collection.py/clear_expired/original