This will delete existing instances with the same extension

def _delete_existing(self, project_file, session):
        """
        This will delete existing instances with the same extension
        """
        # remove existing grid if exists
        existing_elev = session.query(RasterMapFile).\
                                      filter(RasterMapFile.projectFile == project_file).\
                                      filter(RasterMapFile.fileExtension == self.fileExtension).\
                                      all()
        if existing_elev:
            session.delete(existing_elev)
            session.commit()