Skip to content

Commit

Permalink
[FIX] Manage jsonb fields
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-dacosta committed Sep 25, 2023
1 parent 36aaf3e commit fe71ae7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sql_export_excel/models/sql_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def excel_get_data_from_query(self, variable_dict):
col_position = 1
for index, row in enumerate(res, row_position):
for col, val in enumerate(row, col_position):
# manage jsonb field as dict are not writable on the excel cell
if isinstance(val, dict):
val = str(val)

Check warning on line 115 in sql_export_excel/models/sql_export.py

View check run for this annotation

Codecov / codecov/patch

sql_export_excel/models/sql_export.py#L115

Added line #L115 was not covered by tests
ws.cell(row=index, column=col).value = val
output = BytesIO()
wb.save(output)
Expand Down

0 comments on commit fe71ae7

Please sign in to comment.