Parse SQL Dumps to JSON Objects
Project description
README
Parse SQL Dumps to JSON Objects. Tool for Administrators, Data Scientists and Hackers. Supported DBMS: MySQL, SQL Server, PotsgreSQL and other.
Installation:
# i recommend use pipx instead pip
pipx install sqldump2json
Insert statements are converted to JSON objects on each new line:
$ sqldump2json -i testdata/dump.sql
{"table_name": "actor", "values": [1, "PENELOPE", "GUINESS", "2006-02-15 04:34:33"]}
{"table_name": "actor", "values": [2, "NICK", "WAHLBERG", "2006-02-15 04:34:33"]}
{"table_name": "actor", "values": [3, "ED", "CHASE", "2006-02-15 04:34:33"]}
...
The file is not read entirely into RAM, so this utility can be used to process huge files.
Use jq to process JSON (sort, filter and etc):
$ ./sqldump2json -i testdata/dump.sql | jq -r 'select(.table_name == "actor").values | @tsv'
1 PENELOPE GUINESS 2006-02-15 04:34:33
2 NICK WAHLBERG 2006-02-15 04:34:33
3 ED CHASE 2006-02-15 04:34:33
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqldump2json-0.1.0.tar.gz
(6.7 kB
view hashes)
Built Distribution
Close
Hashes for sqldump2json-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 170da7322ac91e0e31e541e948bd67e1e4d2ba2a9f3fbfc7a6b1d4e510d232d8 |
|
MD5 | 7d31b9a1b6cf24d6079052761d87e360 |
|
BLAKE2b-256 | b489b0b73d7554a0c5e07b9761e1ccbacc865173183a7423d20c8107a274be5d |