Skip to content

Commit

Permalink
Use set in fetch_columns for efficient (#5336)
Browse files Browse the repository at this point in the history
Change list to set
  • Loading branch information
zhongjiajie authored Jul 31, 2023
1 parent 4155507 commit a9a348c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions redash/query_runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def run_query(self, query, user):
raise NotImplementedError()

def fetch_columns(self, columns):
column_names = []
column_names = set()
duplicates_counter = 1
new_columns = []

Expand All @@ -222,7 +222,7 @@ def fetch_columns(self, columns):
column_name = "{}{}".format(column_name, duplicates_counter)
duplicates_counter += 1

column_names.append(column_name)
column_names.add(column_name)
new_columns.append({"name": column_name, "friendly_name": column_name, "type": col[1]})

return new_columns
Expand Down

0 comments on commit a9a348c

Please sign in to comment.