dataimport/massive_store.py
changeset 10859 375a8232e61c
parent 10856 b839167d99a4
child 10861 6205b89c3af6
equal deleted inserted replaced
10858:1a3e56e346d2 10859:375a8232e61c
    19 
    19 
    20 import logging
    20 import logging
    21 from datetime import datetime
    21 from datetime import datetime
    22 from collections import defaultdict
    22 from collections import defaultdict
    23 from io import StringIO
    23 from io import StringIO
       
    24 
       
    25 from six.moves import range
    24 
    26 
    25 from yams.constraints import SizeConstraint
    27 from yams.constraints import SizeConstraint
    26 
    28 
    27 from psycopg2 import ProgrammingError
    29 from psycopg2 import ProgrammingError
    28 
    30 
   411         """ Function getting the next eid. This is done by preselecting
   413         """ Function getting the next eid. This is done by preselecting
   412         a given number of eids from the 'entities_id_seq', and then
   414         a given number of eids from the 'entities_id_seq', and then
   413         storing them"""
   415         storing them"""
   414         while True:
   416         while True:
   415             last_eid = self._cnx.repo.system_source.create_eid(self._cnx, self._eids_seq_range)
   417             last_eid = self._cnx.repo.system_source.create_eid(self._cnx, self._eids_seq_range)
   416             for eid in xrange(last_eid - self._eids_seq_range + 1, last_eid + 1):
   418             for eid in range(last_eid - self._eids_seq_range + 1, last_eid + 1):
   417                 yield eid
   419                 yield eid
   418 
   420 
   419     def apply_size_constraints(self, etype, kwargs):
   421     def apply_size_constraints(self, etype, kwargs):
   420         """ Apply the size constraints for a given etype, attribute and value
   422         """ Apply the size constraints for a given etype, attribute and value
   421         """
   423         """