Fix DSV export for NUL bytes - #7782
Conversation
Greptile SummaryThe PR prevents embedded NUL bytes from breaking CSV and TSV exports while preserving stored query-result rows.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| redash/serializers/query_result.py | Sanitizes string values immediately before DSV writing and performs conversions on a shallow row copy. |
| tests/serializers/test_query_results.py | Adds focused regression coverage confirming embedded NUL bytes are removed from exported string fields. |
Reviews (2): Last reviewed commit: "Apply backend formatter" | Re-trigger Greptile
|
Updated this PR with a formatting-only commit to satisfy Validated locally:
The targeted pytest command still cannot collect locally because this checkout is missing the Redash runtime dependency |
|
The python CSV exportor issue looks already being solved on the Python3.13. |
|
Closing this after testing the same Given that the original failure is no longer reproducible on the current supported Python version, withdrawing this sanitization change. |
What type of PR is this?
Bug fix
Description
CSV and TSV export can fail when query results contain embedded NUL bytes because Python's CSV writer raises while trying to escape those values. This change removes NUL bytes from string fields before DSV serialization and avoids mutating the stored query result row during export.
Fixes #7758
Validation
git diff --checkpython -m pytest tests\serializers\test_query_results.py(blocked locally: missing Redash runtime dependencyredis)