equal
deleted
inserted
replaced
391 continue |
391 continue |
392 table = statement.split()[2] |
392 table = statement.split()[2] |
393 if isinstance(data[0], (tuple, list)): |
393 if isinstance(data[0], (tuple, list)): |
394 columns = None |
394 columns = None |
395 else: |
395 else: |
396 columns = data[0].keys() |
396 columns = list(data[0]) |
397 execmany_func(cu, statement, data, table, columns, encoding) |
397 execmany_func(cu, statement, data, table, columns, encoding) |
398 except Exception: |
398 except Exception: |
399 print 'unable to copy data into table %s', table |
399 print 'unable to copy data into table %s', table |
400 # Error in import statement, save data in dump_output_dir |
400 # Error in import statement, save data in dump_output_dir |
401 if dump_output_dir is not None: |
401 if dump_output_dir is not None: |
753 for errkey, error in self.errors.items(): |
753 for errkey, error in self.errors.items(): |
754 self.tell("\n%s (%s): %d\n" % (error[0], errkey, len(error[1]))) |
754 self.tell("\n%s (%s): %d\n" % (error[0], errkey, len(error[1]))) |
755 self.tell(pformat(sorted(error[1]))) |
755 self.tell(pformat(sorted(error[1]))) |
756 |
756 |
757 def _print_stats(self): |
757 def _print_stats(self): |
758 nberrors = sum(len(err) for err in self.errors.values()) |
758 nberrors = sum(len(err) for err in self.errors.itervalues()) |
759 self.tell('\nImport statistics: %i entities, %i types, %i relations and %i errors' |
759 self.tell('\nImport statistics: %i entities, %i types, %i relations and %i errors' |
760 % (self.store.nb_inserted_entities, |
760 % (self.store.nb_inserted_entities, |
761 self.store.nb_inserted_types, |
761 self.store.nb_inserted_types, |
762 self.store.nb_inserted_relations, |
762 self.store.nb_inserted_relations, |
763 nberrors)) |
763 nberrors)) |
1054 for statement, datalist in _inlined_relations_sql.iteritems(): |
1054 for statement, datalist in _inlined_relations_sql.iteritems(): |
1055 new_datalist = [] |
1055 new_datalist = [] |
1056 # for a given inlined relation, |
1056 # for a given inlined relation, |
1057 # browse each couple to be inserted |
1057 # browse each couple to be inserted |
1058 for data in datalist: |
1058 for data in datalist: |
1059 keys = data.keys() |
1059 keys = list(data) |
1060 # For inlined relations, it exists only two case: |
1060 # For inlined relations, it exists only two case: |
1061 # (rtype, cw_eid) or (cw_eid, rtype) |
1061 # (rtype, cw_eid) or (cw_eid, rtype) |
1062 if keys[0] == 'cw_eid': |
1062 if keys[0] == 'cw_eid': |
1063 rtype = keys[1] |
1063 rtype = keys[1] |
1064 else: |
1064 else: |