Write split db-report downloads as a zip#16
Open
jiatolentino wants to merge 1 commit into
Open
Conversation
carlosfunk
requested changes
Jun 22, 2026
| code=ErrorCode.INVALID_INPUT, | ||
| hint=f"Re-run with -o <path>.zip (e.g. -o discovery_report_{run_id}.zip).", | ||
| ) | ||
| target = output if output.suffix.lower() == ".zip" else output.with_suffix(".zip") |
Member
There was a problem hiding this comment.
a file like report.2026.06 would be converted to report.2026.zip
Suggested change
| target = output if output.suffix.lower() == ".zip" else output.with_suffix(".zip") | |
| target = output if output.suffix.lower() == ".zip" else output.parent / (output.name + ".zip") |
Collaborator
Author
There was a problem hiding this comment.
Applied your suggestion (output.parent / (output.name + ".zip")), so multi-dot names are preserved: report.2026.06 → report.2026.06.zip instead of report.2026.zip. Added a regression test using that exact name.
91b654c to
68a5147
Compare
carlosfunk
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dm discover db-reportnow handles the split-zip format: when the server returns a zip of CSV parts, the CLI writes it as a binary.zipinstead of mangling it as text.Background
Large discovery reports are now split server-side into a zip of numbered CSV parts (datamasque DM-3165).
datamasque-python'sget_db_discovery_result_reportreturnsbytesfor that case.What changed
db-reportbranches on the client return type:str(CSV) → unchanged (write to-o, or echo to stdout).bytes(zip) → write the binary archive, correcting a non-.zipoutput path to.zip. Requires-o(a binary zip can't be streamed to stdout); aborts with a clear hint otherwise.Testing
pytest tests/commands/test_discovery.py— added split-zip and no-output abort tests.Dependency
datamasque-pythonreturningbytesfor split reports (companion PR). Bump the minimumdatamasque-pythonpin once that release is cut — otherwise an older client returns corrupt text against a new server.