(predicted_sql, ground_truth, db_path)
| 17 | |
| 18 | |
| 19 | def execute_sql(predicted_sql, ground_truth, db_path): |
| 20 | conn = sqlite3.connect(db_path) |
| 21 | # Connect to the database |
| 22 | cursor = conn.cursor() |
| 23 | cursor.execute(predicted_sql) |
| 24 | predicted_res = cursor.fetchall() |
| 25 | cursor.execute(ground_truth) |
| 26 | ground_truth_res = cursor.fetchall() |
| 27 | res = 0 |
| 28 | if set(predicted_res) == set(ground_truth_res): |
| 29 | res = 1 |
| 30 | return res |
| 31 | |
| 32 | |
| 33 | def execute_model(predicted_sql, ground_truth, db_place, idx, meta_time_out): |