Skip to main content

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqldump2json-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file sqldump2json-0.1.0.tar.gz.

File metadata

  • Download URL: sqldump2json-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.5.7-arch1-1

File hashes

Hashes for sqldump2json-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dcce687fa76fd44c38ab2af5284d4f38452d1eb2cca5cad40892d5a3411e5daa
MD5 39b3678f28853961c8e66e9cfe288747
BLAKE2b-256 f0fb05b1f4f3c3b883c3cf53a650da1292d7590422633bd8905ac1be08dd6c50

See more details on using hashes here.

File details

Details for the file sqldump2json-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sqldump2json-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.5.7-arch1-1

File hashes

Hashes for sqldump2json-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 170da7322ac91e0e31e541e948bd67e1e4d2ba2a9f3fbfc7a6b1d4e510d232d8
MD5 7d31b9a1b6cf24d6079052761d87e360
BLAKE2b-256 b489b0b73d7554a0c5e07b9761e1ccbacc865173183a7423d20c8107a274be5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page