from sqlalchemy import func
cursor = self.db.query(func.sum(Drive.wipe_end - Drive.wipe_start)).filter(
    Drive.package_id == package.package_id).filter(Drive.wipe_end != None)
Sum fields in sqlAlchemy