Skip to content

Commit

Permalink
de-duplicate colnames if they are identical
Browse files Browse the repository at this point in the history
  • Loading branch information
rishsriv committed May 16, 2024
1 parent 958af22 commit aea5406
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions defog/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def execute_query_once(db_type: str, db_creds, query: str):

cur.execute(query)
colnames = [desc[0] for desc in cur.description]

# if there are any column names that are the same, we need to deduplicate them
colnames = [f"{col}_{i}" if colnames.count(col) > 1 else col for i, col in enumerate(colnames)]

results = cur.fetchall()
cur.close()
conn.close()
Expand Down

0 comments on commit aea5406

Please sign in to comment.