[dataimport] simplify SQLGenSourceWrapper.add_info
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 29 Jan 2016 10:06:36 +0100
changeset 11089 731d217e4a31
parent 11088 b62b9d78b533
child 11090 b4b854c25de5
[dataimport] simplify SQLGenSourceWrapper.add_info At this point 'CWSource' is a thing (we're not in the middle of a migration), and source.eid won't be None (we read it from the db)
dataimport/pgstore.py
--- a/dataimport/pgstore.py	Mon Feb 01 15:10:35 2016 +0100
+++ b/dataimport/pgstore.py	Fri Jan 29 10:06:36 2016 +0100
@@ -436,9 +436,8 @@
                 self._handle_is_relation_sql(cnx,
                                              'INSERT INTO is_instance_of_relation(eid_from,eid_to) VALUES (%s,%s)',
                                              (entity.eid, eschema_eid(cnx, eschema)))
-        if 'CWSource' in self.schema and source.eid is not None: # else, cw < 3.10
-            self._handle_is_relation_sql(cnx, 'INSERT INTO cw_source_relation(eid_from,eid_to) VALUES (%s,%s)',
-                                         (entity.eid, source.eid))
+        self._handle_is_relation_sql(cnx, 'INSERT INTO cw_source_relation(eid_from,eid_to) VALUES (%s,%s)',
+                                     (entity.eid, source.eid))
         # now we can update the full text index
         if self.do_fti and self.need_fti_indexation(entity.cw_etype):
             self.index_entity(cnx, entity=entity)