(self, sql)
| 166 | return -1 |
| 167 | |
| 168 | def mysql_cost_estimation(self, sql): |
| 169 | try: |
| 170 | success, res = self.execute_sql('explain format=json ' + sql) |
| 171 | if success == 1: |
| 172 | total_cost = self.get_mysql_total_cost(0, json.loads(res[0][0])) |
| 173 | return float(total_cost) |
| 174 | else: |
| 175 | return -1 |
| 176 | except Exception as error: |
| 177 | logging.error('mysql_cost_estimation Exception', error) |
| 178 | return -1 |
| 179 | |
| 180 | def get_mysql_total_cost(self, total_cost, res): |
| 181 | if isinstance(res, dict): |
no test coverage detected