def insert_hits(hits, objectIDs, engine): l = [] for i in hits: d = make_dict(i) objectID = d['objectID'] if objectID in objectIDs: continue else: objectIDs.add(objectID) l.append(d) insert_core(l, engine)
def is_this_json_in_db(hits, objectIDs): hits_total = len(hits) db_items_count = 0 for i in hits: d = make_dict(i) if d['objectID'] in objectIDs: db_items_count += 1 if db_items_count == hits_total: return True else: return False