895 assert cnx.cnxset is not None |
895 assert cnx.cnxset is not None |
896 # begin by inserting eid/type/source/extid into the entities table |
896 # begin by inserting eid/type/source/extid into the entities table |
897 if extid is not None: |
897 if extid is not None: |
898 assert isinstance(extid, str) |
898 assert isinstance(extid, str) |
899 extid = b64encode(extid) |
899 extid = b64encode(extid) |
900 attrs = {'type': entity.cw_etype, 'eid': entity.eid, 'extid': extid and unicode(extid), |
900 attrs = {'type': unicode(entity.cw_etype), 'eid': entity.eid, 'extid': extid and unicode(extid), |
901 'asource': unicode(source.uri)} |
901 'asource': unicode(source.uri)} |
902 self._handle_insert_entity_sql(cnx, self.sqlgen.insert('entities', attrs), attrs) |
902 self._handle_insert_entity_sql(cnx, self.sqlgen.insert('entities', attrs), attrs) |
903 # insert core relations: is, is_instance_of and cw_source |
903 # insert core relations: is, is_instance_of and cw_source |
904 try: |
904 try: |
905 self._handle_is_relation_sql(cnx, 'INSERT INTO is_relation(eid_from,eid_to) VALUES (%s,%s)', |
905 self._handle_is_relation_sql(cnx, 'INSERT INTO is_relation(eid_from,eid_to) VALUES (%s,%s)', |