dataimport/massive_store.py
changeset 10867 ca73ee6d24ad
parent 10865 2537df9fdd27
child 10869 575982c948a9
equal deleted inserted replaced
10866:ed62ba97d79e 10867:ca73ee6d24ad
    22 from collections import defaultdict
    22 from collections import defaultdict
    23 from io import StringIO
    23 from io import StringIO
    24 
    24 
    25 from six.moves import range
    25 from six.moves import range
    26 
    26 
    27 from logilab.common.deprecation import deprecated
       
    28 from yams.constraints import SizeConstraint
    27 from yams.constraints import SizeConstraint
    29 
    28 
    30 from psycopg2 import ProgrammingError
    29 from psycopg2 import ProgrammingError
    31 
    30 
    32 from cubicweb.dataimport import stores, pgstore
    31 from cubicweb.dataimport import stores, pgstore
   514         for table_name in ('dataio_initialized', 'dataio_constraints', 'dataio_metadata'):
   513         for table_name in ('dataio_initialized', 'dataio_constraints', 'dataio_metadata'):
   515             if self._dbh.table_exists(table_name):
   514             if self._dbh.table_exists(table_name):
   516                 self.sql('DROP TABLE %s' % table_name)
   515                 self.sql('DROP TABLE %s' % table_name)
   517         self.commit()
   516         self.commit()
   518 
   517 
   519     @deprecated('[3.22] use prepare_insert_entity instead')
       
   520     def create_entity(self, etype, **kwargs):
       
   521         """ Create an entity
       
   522         """
       
   523         eid = self.prepare_insert_entity(etype, **kwargs)
       
   524         entity = self._cnx.vreg['etypes'].etype_class(etype)(self._cnx)
       
   525         entity.cw_attr_cache.update(kwargs)
       
   526         entity.eid = eid
       
   527         return entity
       
   528 
       
   529     @deprecated('[3.22] use prepare_insert_relation instead')
       
   530     def relate(self, subj_eid, rtype, obj_eid, *args, **kwargs):
       
   531         self.prepare_insert_relation(subj_eid, rtype, obj_eid, *args, **kwargs)
       
   532 
       
   533     @deprecated('[3.22] use finish instead')
       
   534     def cleanup(self):
       
   535         self.finish()
       
   536 
       
   537 
       
   538     ### FLUSH #################################################################
   518     ### FLUSH #################################################################
   539 
   519 
   540     def on_commit(self):
   520     def on_commit(self):
   541         if self.on_commit_callback:
   521         if self.on_commit_callback:
   542             self.on_commit_callback()
   522             self.on_commit_callback()