Skip to content

Commit

Permalink
Join all tables in accuracy test suite to make master table
Browse files Browse the repository at this point in the history
  • Loading branch information
navdeep-G committed Jan 20, 2016
1 parent f57ef30 commit 84f8ed2
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions scripts/send_to_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,53 @@ def add_accuracy_data(self):
h2o.rollback()
assert False, "Failed to add accuracy test cases to h2o database!"

def drop_join_test_cases_tables(self):

#Connect to mysql database
h2o = mysql.connector.connect(user='root', password='0xdata', host='172.16.2.178', database='h2o')
cursor = h2o.cursor()

try:
drop_join_test_cases_query = """
DROP TABLES IF EXISTS TestCasesResults;
"""

cursor.execute(drop_join_test_cases_query)
except:
traceback.print_exc()
h2o.rollback()
assert False, "Failed to drop TestCasesResults table!"

def join_test_cases_results(self):

#Connect to mysql database
h2o = mysql.connector.connect(client_flags=[ClientFlag.LOCAL_FILES],user='root', password='0xdata', host='172.16.2.178', database='h2o')
cursor = h2o.cursor()

#Drop table if exists before re creating
self.drop_join_test_cases_tables()

try:
join_query = """
CREATE TABLE TestCasesResults AS(
SELECT *
FROM AccuracyTestCaseResults
LEFT JOIN TestCases
ON AccuracyTestCaseResults.testcase_id = TestCases.test_case_id
LEFT JOIN AccuracyDatasets
ON TestCases.training_data_set_id = AccuracyDatasets.data_set_id);
"""

cursor.execute(join_query)
except:
traceback.print_exc()
h2o.rollback()
assert False, "Failed to join AccuracyTestCaseResults, TestCases, and AccuracyDatasets!"

cursor.close()
h2o.close()

if __name__ == '__main__':
SendDataToMysql().add_test_cases_to_h2o()
SendDataToMysql().add_accuracy_data()
#SendDataToMysql().add_test_cases_to_h2o()
#SendDataToMysql().add_accuracy_data()
SendDataToMysql().join_test_cases_results()

0 comments on commit 84f8ed2

Please sign in to comment.