(session, db_kb, labels)
:param session:
        :param DbKnowledgeBase db_kb:
        :param Labels labels:
        :return:                        None
def dump(session, db_kb, labels):
        """

        :param session:
        :param DbKnowledgeBase db_kb:
        :param Labels labels:
        :return:                        None
        """

        for addr, name in labels.items():
            db_label = session.query(DbLabel).filter_by(
                kb=db_kb,
                addr=addr,
            ).scalar()
            if db_label is not None:
                if name == db_label.name:
                    continue
                db_label.name = name
            else:
                db_label = DbLabel(
                    kb=db_kb,
                    addr=addr,
                    name=name,
                )
                session.add(db_label)
def dump ( session , db_kb , labels ) : for addr , name in labels . items ( ) : db_label = session . query ( DbLabel ) . filter_by ( kb = db_kb , addr = addr , ) . scalar ( ) if db_label is not None : if name == db_label . name : continue db_label . name = name else : db_label = DbLabel ( kb = db_kb , addr = addr , name = name , ) session . add ( db_label )