Repository navigation
Commit af137d2
authored
Quote CSV fields containing commas in CLI output (#305)
The CLI's `csv` output built each row with `",".join(...)`, which never
quotes fields. An aggregation formula in the `component_id` column (e.g.
`COALESCE(#396, 0.0) + COALESCE(#397, 0.0)`) contains commas, so it
spilled into extra columns and produced malformed CSV that breaks
downstream parsers like csvm. This switches the output to Python's `csv`
module so such fields are quoted per RFC 4180.
## Changes
- CSV output now uses `csv.writer` instead of manual `",".join(...)`,
quoting any field containing commas.
- Pin the line terminator to `\n` so output stays LF (the `csv` module
defaults to CRLF), matching the previous `print()`-based behavior.2 files changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
201 | | - | |
202 | | - | |
203 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
204 | 209 | | |
205 | | - | |
| 210 | + | |
206 | 211 | | |
207 | 212 | | |
208 | 213 | | |
| |||
0 commit comments