api/dblp_sql.py
def process_record(record):
    """Update the database with the contents of the record."""
    logging.debug('processing record\n%s' % record);
    conn = db.engine.connect()
    paper_id = record.id

    ins = db.papers.insert().\
            values(id=paper_id, title=record.title,
                   venue=record.venue, year=record.year,
                   abstract=record.abstract)

    # attempt to insert a new paper into the db
    result = insert(conn, ins)
    if result is None:
        # since ids come from data, we've already processed this record
        conn.close()
        return False

    # make new records for each author
    for author in record.authors:
        person_id = person_insert(conn, author)
        ins = db.authors.insert().values(paper=paper_id, person=person_id)
        insert(conn, ins)  # may fail, but we don't really care

    for ref in record.refs:
        ins = db.refs.insert().values(paper=paper_id, ref=ref)
        insert(conn, ins)

    conn.close()
    return True
Update the database with the contents of the record.
Update the database with the contents of the record.
Update the database with the contents of the record .
def process_record(record):
    logging.debug('processing record\n%s' % record);
    conn = db.engine.connect()
    paper_id = record.id
    ins = db.papers.insert().\
            values(id=paper_id, title=record.title,
                   venue=record.venue, year=record.year,
                   abstract=record.abstract)
    result = insert(conn, ins)
    if result is None:
        conn.close()
        return False
    for author in record.authors:
        person_id = person_insert(conn, author)
        ins = db.authors.insert().values(paper=paper_id, person=person_id)
        insert(conn, ins)  
    for ref in record.refs:
        ins = db.refs.insert().values(paper=paper_id, ref=ref)
        insert(conn, ins)
    conn.close()
    return True
def process_record ( record ) : logging . debug ( 'processing record\n%s' % record ) ; conn = db . engine . connect ( ) paper_id = record . id ins = db . papers . insert ( ) . values ( id = paper_id , title = record . title , venue = record . venue , year = record . year , abstract = record . abstract ) result = insert ( conn , ins ) if result is None : conn . close ( ) return False for author in record . authors : person_id = person_insert ( conn , author ) ins = db . authors . insert ( ) . values ( paper = paper_id , person = person_id ) insert ( conn , ins ) for ref in record . refs : ins = db . refs . insert ( ) . values ( paper = paper_id , ref = ref ) insert ( conn , ins ) conn . close ( ) return True
Update the database with the contents of the record.
Update the database with the contents of the record .
"""Update the database with the contents of the record.""" # attempt to insert a new paper into the db # since ids come from data, we've already processed this record # make new records for each author # may fail, but we don't really care
record