diff --git a/redash/query_runner/vertica.py b/redash/query_runner/vertica.py index 810cf73985..8dcb97e421 100644 --- a/redash/query_runner/vertica.py +++ b/redash/query_runner/vertica.py @@ -126,16 +126,12 @@ def run_query(self, query, user): logger.debug("Vertica running query: %s", query) cursor.execute(query) - # TODO - very similar to pg.py if cursor.description is not None: - columns_data = [(i[0], i[1]) for i in cursor.description] - - # bug -- same name columns will always be assigned single last value - # corrected with fetch_columns in pull request https://github.com/getredash/redash/pull/4201 - rows = [dict(zip((c[0] for c in columns_data), row)) for row in cursor.fetchall()] - columns = [{'name': col[0], - 'friendly_name': col[0], - 'type': types_map.get(col[1], None)} for col in columns_data] + columns_data = [(i[0], types_map.get(i[1], None)) for i in cursor.description] + + columns = self.fetch_columns(column_data) + rows = [dict(zip(([c['name'] for c in columns]), r)) + for r in cursor.fetchall()] data = {'columns': columns, 'rows': rows} json_data = json_dumps(data)