def main(src_dir, dst_fp):
    engine, session = get_engine_and_session(dst_fp)
    objectIDs = get_objectIDs(session)
    print('get_objectIDs done')

    filelist = list(yield_filelist(src_dir))
    total = len(filelist)

    for n, fp in enumerate(filelist):
        j = load_json(fp)
        hits = j['hits']
        insert_hits(hits, objectIDs, engine)
        print('{0}/{1}'.format(n + 1, total))
    commit(session)
def main(src_dir, dst_fp):
    engine, session = get_engine_and_session(dst_fp)
    objectIDs = get_objectIDs(session)
    print('get_objectIDs done')

    filelist = list(yield_filelist(src_dir))
    total = len(filelist)

    for n, fp in enumerate(filelist):
        j = load_json(fp)
        hits = j['hits']
        is_ok_to_delete = is_this_json_in_db(hits, objectIDs)
        if is_ok_to_delete:
            os.remove(fp)
        print('{0}/{1}'.format(n, total))