Skip to content
SQL Dump Parser - Query MySQL Dumps Directly without loading them into MySQL
Go TSQL Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/sqlread
debug Adds a simple tool for debugging LexItem channels Oct 16, 2017
mapcache Adds a comment Aug 12, 2019
testfixtures
vendor/github.com Adds readline adapter Oct 15, 2018
.drone.yml
.gitignore Adds makefile / release info Oct 15, 2018
.travis.yml Update .travis.yml Oct 15, 2018
Gopkg.lock Adds readline adapter Oct 15, 2018
Gopkg.toml use dep for reproducible builds Dec 19, 2017
LICENSE.md Adds license Sep 6, 2017
README.md Update README.md Aug 12, 2019
detail.go Fixes infinite loop Sep 13, 2017
detail_test.go Roughs in detail parser Sep 13, 2017
go.mod Move to Go Modules from dep Jun 13, 2019
go.sum Move to Go Modules from dep Jun 13, 2019
interpreter.go Adds SHOW CREATE TABLE support throughout Aug 12, 2019
lexer_test.go Test correction Dec 8, 2017
lexitemtype_string.go Adds SHOW CREATE TABLE support throughout Aug 12, 2019
makefile Slight makefile optimization Nov 11, 2018
parser.go Small clean up Sep 15, 2017
query.go
scanner.go Adds SHOW CREATE TABLE support throughout Aug 12, 2019
states.go
summary.go Cleans up map lookup Aug 12, 2019

README.md

sqlread

Go Report Card GoDoc Build Status Build Status

sqlread is a mysql dump parser that allows you to query MySQL dumps directly without loading them into MySQL, and export specific tables from said dumps.

Currently very picky and only likes mysqldump generated output dumps. Milage may vary on dumps created with other tools like Navicat. Compatability is a work in progress.

Todo:

While the code is quite usable and useful, I still have a ways to go.

  • Query fields without backticks - currently all fields must be wrapped in backticks.
  • General Expression Support
    • Basic WHERE support
    • Basic ORDER BY support
  • Optimization of heavily \'d string parsing

Installation

From Source

go get -u -v github.com/donatj/sqlread/cmd/sqlread

Precompiled Binaries

Availible on the Releases page currently for Linux and macOS.

Example usage

$ sqlread buildings.sql
2017/12/22 12:23:52 starting initial pass
2017/12/22 12:23:52 loaded from cache
2017/12/22 12:23:52 finished initial pass
> SHOW TABLES;
buildings
2017/12/22 12:24:01 restarting lexer

> SHOW COLUMNS FROM `buildings`;
building_id,int
account_id,int
title,varchar
descr,varchar
city,varchar
state_id,smallint
zip_code,varchar
deleted,tinyint
2017/12/22 12:24:08 restarting lexer

> SELECT `building_id`, `title` FROM `buildings`;
2,Home Building
190,Test Building (demo)
192,Donat Building
194,Other Building
201,Sample Building (demo)
205,Johnson Building
2017/12/22 12:24:44 restarting lexer

> SELECT `building_id`, `title` FROM `buildings` INTO OUTFILE "dump.csv";
2017/12/22 12:27:43 written to `dump.csv`
2017/12/22 12:27:43 restarting lexer
You can’t perform that action at this time.