Exemple #1
0
	def import_csv(self):
		if self.table_name == 'rec_dat':
			recall.Recall_rec(self.file_name).read_data(self.related_id, self.delete_existing, self.rec_typ)
		elif self.table_name == 'rec_cnst':
			recall.Recall_rec(self.file_name).read_const_data()
		elif self.table_name in dtl_names:
			decision_table.D_table_dtl(self.file_name, file_type=self.table_name).read()
		elif self.table_name == 'mgt_sch':
			lum.Management_sch(self.file_name).read()
		else:
			fileio.read_csv_file(self.file_name, self.table, project_base.db, 0, ignore_id_col=self.ignore_id_col, overwrite=fileio.FileOverwrite.replace, remove_spaces_cols=['name'])
Exemple #2
0
	def import_recall(self):
		if self.input_files_dir is None or not os.path.exists(self.input_files_dir):
			sys.exit('Please provide an input files directory containing your files.')

		prog_items = Recall_rec.select().count()
		prog_step = 0 if prog_items == 0 else 100 / prog_items
		prog = 0
		for rec in Recall_rec.select():
			rec_path = os.path.join(self.input_files_dir, '{}.csv'.format(rec.name.strip()))
			if os.path.exists(rec_path):
				prog += prog_step
				self.emit_progress(prog, "Importing {}.csv...".format(rec.name.strip()))
				recall.Recall_rec(rec_path).read_data(rec.id, self.delete_existing)

		rec_path = os.path.join(self.input_files_dir, 'recall.csv')
		if os.path.exists(rec_path):
			recall.Recall_rec(rec_path).read_const_data()
    def write_recall(self, start_prog, allocated_prog):
        num_files = 1
        files = self.get_file_names("recall", num_files)

        prog_step = round(allocated_prog / num_files)
        prog = start_prog

        recall_rec_file = files[0].strip()
        if recall_rec_file != NULL_FILE:
            self.update_file_status(prog, recall_rec_file)
            recall.Recall_rec(os.path.join(self.__dir, recall_rec_file),
                              self.__version, self.__swat_version).write()