my-cmd - MySQL interactive and batch query command-line tool »
JSON Lines text format, also called newline-delimited JSON (NDJSON), or Line-delimited JSON (LDJSON). JSON Lines files may be saved with the file extension .jsonl, *.ndjson, *.ldjson.
MongoDB's mongoexport can export collections in JSON Lines format.
parameters:
table: table name ("all" for unload all table)
query: sql query string (can not use multi-line sql)
sqlfile: sql script file contains the query you want to unload
schema: schema name, use this prameter to unload specific schema's data, if not set, use logon user's default schema
datafile: data file name
folder: data files folder (for unload all table)
filetype: json|jsonl|ndjson|ldjson
dateformat: date format (e.g. "yyyy-mm-dd hh24:mi:ss")
timestampformat: timestamp format (e.g. "yyyy-mm-dd-hh24.mi.ss.ff6")
quit = y|n (quit my-cmd after run in batch mode)
Unload table example
my-cmd> unload table=jobs datafile=e:\temp\tables\jobs.json filetype=json;
Unload query example
my-cmd> unload query="select job_id,job_title from jobs"
> datafile=e:\temp\tables\jobs_part.json
> filetype=json;
Unload as sqlfile example
sqlfile content: unload_jobs.sql
select job_id,job_title from jobs
my-cmd> unload sqlfile=e:\temp\tables\unload_jobs.sql
> datafile=e:\temp\tables\jobs_part2.json
> filetype=json;
Unload schema example
my-cmd> unload table=all folder=e:\temp\tables filetype=json;
In batch mode
my-cmd dsn="pan:withdata@192.168.0.102:3306/test" task=unload table=all folder=e:\temp\tables filetype=json quit=y