def putResult(d): if 'rcsid' not in d: return key = d['rcsid'] prev_person = Person.get_by_id(key) if prev_person: logging.info("Updating %s", key) prev_person.update(d) prev_person.put() search.Index(name=_INDEX_NAME).put(createDocument(prev_person)) else: logging.info("New %s", key) person = Person.buildPerson(d) person.put() search.Index(name=_INDEX_NAME).put(createDocument(person))
def putResult(d): if 'rcsid' not in d: return key = d['rcsid'] prev_person = Person.get_by_id(key) if prev_person: logging.info("Updating %s", key) prev_person.update(d) prev_person.put() search.Index(name=_INDEX_NAME).put(createDocument(prev_person)) else: logging.info("New %s", key) person = Person.buildPerson(d) person.put() search.Index(name=_INDEX_NAME).put(createDocument(person))
def putResult(d): """ person = Person.buildPerson(d) #if person.department: #DepartmentKeyword.buildKeywords(person.department) person.put() """ person = Person.buildPerson(d) conn = rdbms.connect(instance=_INSTANCE_NAME, database="rpidirectory") cursor = conn.cursor() query = 'REPLACE INTO rpidirectory (`name`, `campus_mailstop`, `department`, `email`, `fax`, `first_name`, `homepage`, `last_name`, `mailing_address`, `major`, `office_location`, `phone`, `rcsid`, `title`, `year`, `directory_id`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' args = (person.rcsid, person.campus_mailstop, person.department, person.email, person.fax, person.first_name, person.homepage, person.last_name, person.mailing_address, person.major, person.office_location, person.phone, person.rcsid, person.title, person.year, str(person.directory_id)) logging.info(query) logging.info(repr(args)) cursor.execute(query, args) conn.close()
def putResult(d): person = Person.buildPerson(d) #if person.department: #DepartmentKeyword.buildKeywords(person.department) person.put() search.Index(name=_INDEX_NAME).add(createDocument(person))