I would like to know how to select mysql on bash and output it on JSON.
Specifically,
echo "SELECT* from testtable;" | mysql --defaults-extra-file=./my.conf testdb
I would like to print the results in JSON and use the jq command to handle the values.
The version of mysql is
$mysql --version
mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper
Please let me know if you know.
mysql bash jq
Run pipe install csvkit
to install the csvjson command.Then,
mysql-B-e "select * from some_table" some_db | csvjson-d$'\t'
If you run , you will be able to do what you want to do what you want to do.
If there is only one thing that doesn't work and the table contains tab characters, you need to think about it a little bit more.
542 Unable to install versioned in Google Colab
547 Who developed the "avformat-59.dll" that comes with FFmpeg?
546 Understanding How to Configure Google API Key
709 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
537 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.