Open astroshot opened 1 year ago
cli-helpers
is meant to be a general library, common for all dbcli projects. It would be great to have an sql formatter in the base library, however, it would have to use the correct dialect (mysql vs postgres vs whatever). I don't know how to do it correctly. But to add the mysql-specific format, like you're proposing, seems a little out of place here. Should it not live in mycli?
UPD ah, my bad, I see what you're doing. Interesting.
Hi, I opened a PR to pgcli last month (https://github.com/dbcli/pgcli/pull/1366) to export output to sqls like mycli and it's suggested to move sql-formatter to cli_helpers.
My idea is that:
For sql output, table name is needed, so parsing function is required. Since cli_helpers only does output format job, so I think it's not good enough to import sqlparse pkg here.
So any suggestions? Thanks for your attention. 😁
Description
Add sql-formatter for *clis, which convert output data to sql format like insertion sqls or updating sqls.
For example, in pgcli, you can get sql-insert output like this:
Checklist
CHANGELOG
.AUTHORS
file (or it's already there).pip install pre-commit && pre-commit install
), and ranblack
on my code.