[IMP] Use new cursor to attach files and load logs in db