Feature: Native CSV output format (--csv)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start with pkg/sqlcmd/formatter.go and trace how existing output formats and the -h header option are wired into the CLI. Check the Go encoding/csv package for RFC 4180 behavior, then verify that --csv produces optional headers, quotes commas and quotes correctly, and uses UTF-8 output.
Written by the indexing model from the issue text.
Description
Summary
Add a --csv flag to output query results in native CSV format.
Use Case
- Export data directly to CSV without needing to set column separator and parse manually
- Integration with data analysis tools (Excel, pandas, etc.)
- Scripting and automation pipelines
Proposed Syntax
sqlcmd -S server -Q "SELECT * FROM users" --csv
Example Output
id,name,email
1,Alice,alice@example.com
2,Bob,bob@example.com
Features
- Proper handling of values containing commas (quote wrapping)
- Proper handling of values containing quotes (escaping)
- Optional header row (controlled by existing -h flag)
- UTF-8 encoding by default
Implementation Notes
- Could leverage existing formatter infrastructure in
pkg/sqlcmd/formatter.go - Consider using Go's standard
encoding/csvpackage for proper RFC 4180 compliance
- Dominant language
- Go
- Stars
- 595
- Forks
- 91
- Avg merge
- 9h 35m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/go-sqlcmd
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
All issues in microsoft/go-sqlcmd
Similar issues
-
textual definition
Difficulty 1/5 Under an hour Newbie friendliness 90/100
geneontology/go-ontology#32653 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
needs design
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100