You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When pasting SQL query in a GitLab or GitHub field, it would be cool to use markdown table instead of backticks. What do you think of a markdown output format ?
Something like -M, --markdown.
$ usql --markdown $DSN< query.sql| COLUMN | NAME ||--------|------|| FOO | BAR || TOTO | TITI || PIF | PAF |
$
I like the idea. For now, outputting as --csv and piping through csvlook from csvkit seems ok to get a markdown table.
Using default delimiters:
usql -c 'select 10 as col1, 20 as col2 union select 30 as col1, 40 as col2;' --csv | csvlook
| col1 | col2 |
| -- | -- |
| 30 | 40 |
| 10 | 20 |
Rendered:
col1
col2
30
40
10
20
Or if the data contains commas, using a custom delimiter:
usql -c 'select 10 as col1, 20 as col2 union select 30 as col1, 40 as col2;' --csv --field-separator "?" | csvlook --snifflimit 0 --delimiter "?"
| col1 | col2 |
| -- | -- |
| 30 | 40 |
| 10 | 20 |
Rendered:
col1
col2
30
40
10
20
To be clear, this is not at all to discourage the idea of a --markdown option to join the likes of --csv, --html, --json, or others. Just commenting with a possible stopgap solution.
Hi,
Thanks for usql and dburl, very useful !
When pasting SQL query in a GitLab or GitHub field, it would be cool to use markdown table instead of backticks. What do you think of a markdown output format ?
Something like
-M, --markdown
.References: https://www.markdownguide.org/extended-syntax/#tables
Regards,
Étienne
The text was updated successfully, but these errors were encountered: