Added skip_headers argument to the csv formatter
Description
A new argument is needed to implement \T csv --skip-headers in mycli, see https://github.com/dbcli/mycli/issues/872
Checklist
- [x] I've added this contribution to the
CHANGELOG. - [x] I've added my name to the
AUTHORSfile (or it's already there). - [x] I installed pre-commit hooks (
pip install pre-commit && pre-commit install), and ranblackon my code. - [x] Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)
@pasenor Is this still relevant, or not anymore (superseded by https://github.com/dbcli/cli_helpers/pull/74)?
I've been working with SQL queries and shell commands to process the output, specifically aiming to retrieve results without headers. Consider the following example:
SELECT
5 >= 0
AND 5 <= 10;
To eliminate the header from the output, I used sed with the mycli command:
mycli --csv --no-warn -e '\n; \. script.sql' mariadb://mysql@localhost/test | sed '1d'
The resulting data output is as follows:
AND 5 <= 10"
"1"
From this, it's clear that while we can manipulate the output to exclude the header, the process isn't as straightforward or clean as it could be. I believe implementing a feature that allows for direct output without headers would greatly enhance usability and efficiency. What are your thoughts on exploring this feature further?