Skip to content

Commit

Permalink
eliminate unnecessary SHOW TABLES which breaks on Vitess
Browse files Browse the repository at this point in the history
  • Loading branch information
nharkins committed Dec 11, 2024
1 parent 38b886e commit 4b77930
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mycli/completion_refresher.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ def refresh_schemata(completer, executor):

@refresher("tables")
def refresh_tables(completer, executor):
completer.extend_relations(executor.tables(), kind="tables")
completer.extend_columns(executor.table_columns(), kind="tables")
table_columns_dbresult = list(executor.table_columns())
completer.extend_relations(table_columns_dbresult, kind="tables")
completer.extend_columns(table_columns_dbresult, kind="tables")


@refresher("users")
Expand Down
3 changes: 3 additions & 0 deletions mycli/sqlcompleter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,9 @@ def extend_columns(self, column_data, kind):

metadata = self.dbmetadata[kind]
for relname, column in column_data:
if relname not in metadata[self.dbname]:
_logger.error("relname '%s' was not found in db '%s'", relname, self.dbname)
continue
metadata[self.dbname][relname].append(column)
self.all_completions.add(column)

Expand Down

0 comments on commit 4b77930

Please sign in to comment.