def createSQLFile(self,params,file_name): writer=FileWriter(file_name) writer.writeLine("BEGIN;"); writer.writeLine(("DELETE FROM datacaster_parameter;")); for p in params: writer.writeLine(p.as_sql()) writer.writeLine("COMMIT;") return writer.get_file()
def loadCastFromFile(self,file): xml=file.read() writer=FileWriter(self.temp_dir + "temp_cast_2.xml" ) writer.writeLine(xml) writer.close() castf=DataCastFactory() cast=castf.castFromXML(self.temp_dir+"temp_cast_2.xml") json=cast.asJSON() return json
def createJSONFile(self,params,file_name): writer=FileWriter(file_name) writer.writeLine("{") writer.writeLine('"parameters":[') for p in params: writer.writeLine(p.as_json() + ",") writer.writeLine("]") writer.writeLine("}") return writer.get_file()
def loadCastFromFile(self, file): xml = file.read() writer = FileWriter(self.temp_dir + "temp_cast_2.xml") writer.writeLine(xml) writer.close() castf = DataCastFactory() cast = castf.castFromXML(self.temp_dir + "temp_cast_2.xml") json = cast.asJSON() return json
def saveCast(self, cast_xml, cast_rid): print cast_rid writer = FileWriter(self.temp_dir + "cast_" + cast_rid + ".xml") writer.writeLine(cast_xml) return "/tmp/cast_" + cast_rid + ".xml"
def createJSONFile(self, params, file_name): writer = FileWriter(file_name) writer.writeLine("{") writer.writeLine('"parameters":[') for p in params: writer.writeLine(p.as_json() + ",") writer.writeLine("]") writer.writeLine("}") return writer.get_file()
def createSQLFile(self, params, file_name): writer = FileWriter(file_name) writer.writeLine("BEGIN;") writer.writeLine(("DELETE FROM datacaster_parameter;")) for p in params: writer.writeLine(p.as_sql()) writer.writeLine("COMMIT;") return writer.get_file()
def saveCast(self,cast_xml,cast_rid): print cast_rid writer=FileWriter(self.temp_dir + "cast_" + cast_rid + ".xml" ) writer.writeLine(cast_xml) return "/tmp/cast_" + cast_rid + ".xml"