(self, question: Optional[str], dbID: Optional[str], need_operate: Optional[bool] = False, only_sql: Optional[bool] = True)
| 134 | ) |
| 135 | |
| 136 | def generateSQL(self, question: Optional[str], dbID: Optional[str], need_operate: Optional[bool] = False, only_sql: Optional[bool] = True): |
| 137 | question = self.sql_prompt_template.format(question=question) |
| 138 | |
| 139 | sql = self.llm.generate_response(input_text=question) |
| 140 | |
| 141 | sql = self.processSQL(sql) |
| 142 | |
| 143 | # only for update and select and insert |
| 144 | if need_operate: |
| 145 | operator_type = get_db_operation_class(sql) |
| 146 | if operator_type == SQL_class.SELECT or operator_type == SQL_class.INSERT: |
| 147 | result = self.sqlHelper.operate(sql=sql, dbID=dbID) |
| 148 | return sql, result |
| 149 | return sql |
| 150 | |
| 151 | def SQL_ERROR_CHECK(self, sql: Optional[str], error: Optional[str], need_operate: Optional[bool] = False, only_sql: Optional[bool] = True, dbID: Optional[str] = None): |
| 152 | question = self.error_prompt_template.format(sql=sql, error=error, structure="") |
no test coverage detected