Skip to content

Commit

Permalink
Merge pull request #341 from briefercloud/athena-rename-columns
Browse files Browse the repository at this point in the history
append suffix to athean columns
  • Loading branch information
vieiralucas authored Feb 17, 2025
2 parents 8d03ad3 + 4a0e20d commit 72623cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/api/src/python/query/athena.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,16 @@ def briefer_make_athena_query():
def to_pandas(athena_data):
columns = []
col_counts = {} # Dictionary to track the count of column names
for col in athena_data["ResultSet"]["ResultSetMetadata"]["ColumnInfo"]:
columns.append({"name": col["Label"], "type": col["Type"], "np_type": convert_type(col["Type"])})
col_name = col["Label"]
if col_name in col_counts:
col_counts[col_name] += 1
col_name = f"{col_name}.{col_counts[col_name]}"
else:
col_counts[col_name] = 0
columns.append({"name": col_name, "type": col["Type"], "np_type": convert_type(col["Type"])})
rows = athena_data["ResultSet"]["Rows"]
data = []
Expand Down

0 comments on commit 72623cf

Please # to comment.