From 4d99f8d8e56fc5d615ba4eea439e32f0dd8466dc Mon Sep 17 00:00:00 2001 From: Kiumars Sabeti Date: Fri, 15 Apr 2022 04:38:04 +0000 Subject: [PATCH] SWDEV-320429: wrapping the comma-containing names in the .csv in double quotes at the time the .csv is generated Change-Id: I62f94a1cf8895eb324080f8aacac3f13c02d7050 --- bin/sqlitedb.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/sqlitedb.py b/bin/sqlitedb.py index 7aadd257..d1584e54 100644 --- a/bin/sqlitedb.py +++ b/bin/sqlitedb.py @@ -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