MCPcopy Index your code
hub / github.com/donatj/sqlread

github.com/donatj/sqlread @v0.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.3 ↗ · + Follow
112 symbols 347 edges 17 files 3 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Extension points exported contracts — how you extend this code

DataWriter (Interface)
(no doc)
cmd/sqlread/query.go

Core symbols most depended-on inside this repo

emit
called by 79
scanner.go
next
called by 30
scanner.go
accept
called by 28
scanner.go
hasPrefix
called by 23
scanner.go
scan
called by 20
parser.go
errorUnexpectedEOF
called by 19
parser.go
errorUnexpectedLex
called by 18
parser.go
hasPrefixI
called by 17
scanner.go

Shape

Function 47
Method 44
Struct 16
FuncType 2
TypeAlias 2
Interface 1

Languages

Go100%

Modules by API surface

states.go23 symbols
scanner.go16 symbols
query.go13 symbols
summary.go9 symbols
parser.go9 symbols
interpreter.go8 symbols
mapcache/cache.go7 symbols
cmd/sqlread/query.go7 symbols
detail.go4 symbols
cmd/sqlread/stdinwrap.go4 symbols
cmd/sqlread/readlinewrap.go4 symbols
cmd/sqlread/main.go3 symbols

For agents

$ claude mcp add sqlread \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact