Skip to content

Commit

Permalink
Simplify the display of table information in the tabledump result.
Browse files Browse the repository at this point in the history
  • Loading branch information
Teingi committed Dec 10, 2024
1 parent 3bf8009 commit 7a0c88b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion handler/gather/gather_tabledump.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def __get_table_schema(self):
columns, result = self.tenant_connector.execute_sql_return_columns_and_data(sql)
if result is None or len(result) == 0:
self.stdio.verbose("excute sql: {0}, result is None".format(sql))
self.__report(sql, columns, result)
else:
self.__report_simple(sql, result[0][1])
return True
except Exception as e:
self.stdio.error("show create table error {0}".format(e))
Expand Down Expand Up @@ -235,6 +236,14 @@ def __report(self, sql, column_names, data):
except Exception as e:
self.stdio.error("report sql result to file: {0} failed, error:{1} ".format(self.file_name, e))

def __report_simple(self, sql, data):
try:
with open(self.file_name, 'a', encoding='utf-8') as f:
f.write('\n\n' + 'obclient > ' + sql + '\n')
f.write(data)
except Exception as e:
self.stdio.error("report sql result to file: {0} failed, error:{1} ".format(self.file_name, e))

def __extract_string(self, s):
if '@' in s:
at_index = s.index('@')
Expand Down

0 comments on commit 7a0c88b

Please sign in to comment.