def query_search_to_print(self, query_file, output_file): os.chdir("../mysql_scripts") # put it in the thesis folder *note to self query_text = "" with open(query_file, "r") as f: query_text = f.read().replace("\n", " ") self.db.execute(query_text) final = list(db.fetchall()) # print read_csv.print_to_csv(output_file, final)
def query_search_to_print(self, query_file, output_file): os.chdir( "../mysql_scripts") #put it in the thesis folder *note to self query_text = "" with open(query_file, 'r') as f: query_text = f.read().replace('\n', ' ') self.db.execute(query_text) final = list(db.fetchall()) #print read_csv.print_to_csv(output_file, final)
def update_table_csv(self, tables_to_update): os.chdir(directory + "data") print "this is the working directory ", os.getcwd() query_text = "SELECT * FROM `Thesis Data`." output_folder = "database_tables/" for table in tables_to_update: output_file = output_folder + table + ".csv" query = query_text + table self.cursor.execute(query) final = list(self.cursor.fetchall()) try: read_csv.print_to_csv(output_file, final) except IOError: print "we have a problem. cannot find" print (os.getcwd() + "/" + output_file) print "Okay, base tables have been updated"
def update_table_csv(self, tables_to_update): os.chdir(directory + "data") print "this is the working directory ", os.getcwd() query_text = "SELECT * FROM `Thesis Data`." output_folder = "database_tables/" for table in tables_to_update: output_file = output_folder + table + ".csv" query = query_text + table self.cursor.execute(query) final = list(self.cursor.fetchall()) try: read_csv.print_to_csv(output_file, final) except IOError: print "we have a problem. cannot find" print(os.getcwd() + "/" + output_file) print "Okay, base tables have been updated"