Skip to content

Commit

Permalink
SWDEV-320429: wrapping the comma-containing names in the .csv in doub…
Browse files Browse the repository at this point in the history
…le quotes at the time the .csv is generated

Change-Id: I62f94a1cf8895eb324080f8aacac3f13c02d7050
  • Loading branch information
kiumarssabeti committed Apr 28, 2022
1 parent 1f925b3 commit 4d99f8d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/sqlitedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ def dump_csv(self, table_name, file_name):
with open(file_name, mode='w') as fd:
fd.write(','.join(fields) + '\n')
for raw in self._get_raws(table_name):
tmp = list(raw)
for idx in range(len(tmp)):
if type(tmp[idx]) == str:
if(not(tmp[idx][0] == tmp[idx][-1] == '"')): tmp[idx] = '"'+tmp[idx]+'"'
raw = tuple(tmp)
fd.write(reduce(lambda a, b: str(a) + ',' + str(b), raw) + '\n')

# dump JSON trace
Expand Down

0 comments on commit 4d99f8d

Please sign in to comment.