| 126 | |
| 127 | @failsoft |
| 128 | def update_input_classification(id: str, ran_sql: bool, rows_returned: int, generated_sql: str): |
| 129 | |
| 130 | if not EVENTS_ENGINE or not id: |
| 131 | return None |
| 132 | |
| 133 | params = { |
| 134 | "id": id, |
| 135 | "ran_sql": ran_sql, |
| 136 | "rows_returned": rows_returned, |
| 137 | "generated_sql": generated_sql |
| 138 | } |
| 139 | |
| 140 | update_query = text(""" |
| 141 | UPDATE input_classifications SET ran_sql = :ran_sql, rows_returned = :rows_returned, generated_sql = :generated_sql |
| 142 | WHERE id = :id |
| 143 | """) |
| 144 | |
| 145 | with EVENTS_ENGINE.connect() as conn: |
| 146 | conn.execute(update_query, params) |
| 147 | conn.commit() |
| 148 | |
| 149 | return {"status": "success"} |
| 150 | |
| 151 | @failsoft |
| 152 | def log_sql_failure(input_text, sql_script, failure_message, attempt_number, app_name, session_id=None): |