@@ -9,6 +9,7 @@ A high-performance SQL INSERT statement parser that processes large SQL files an
9
9
- Parallel processing with configurable worker count
10
10
- Multiple output formats:
11
11
- JSON
12
+ - JSONL
12
13
- CSV
13
14
- Text
14
15
- Buffered I/O for optimal performance
@@ -25,7 +26,7 @@ go build cmd/sqlparser/main.go
25
26
## Usage
26
27
27
28
``` bash
28
- sqlparser [-format= txt| csv| json] [-output= filename] [-workers= N] < sqlfile>
29
+ sqlparser [-format= txt| csv| json| jsonl ] [-output= filename] [-workers= N] < sqlfile>
29
30
```
30
31
31
32
### Arguments
@@ -34,6 +35,7 @@ sqlparser [-format=txt|csv|json] [-output=filename] [-workers=N] <sqlfile>
34
35
- ` txt ` : Human-readable text format
35
36
- ` csv ` : CSV format with headers
36
37
- ` json ` : JSON format with table structure
38
+ - ` jsonl ` : JSON lines format with table structure
37
39
- ` -output ` : Output file path (default: stdout)
38
40
- ` -workers ` : Number of worker threads (default: 1)
39
41
- ` <sqlfile> ` : Input SQL file containing INSERT statements
@@ -64,6 +66,11 @@ sqlparser -format=csv -workers=4 -output=output.csv input.sql
64
66
sqlparser input.sql
65
67
```
66
68
69
+ 4 . Process SQL file and output as JSON lines:
70
+ ``` bash
71
+ sqlparser -format=jsonl -output=output.json input.sql
72
+ ```
73
+
67
74
## Performance Optimization
68
75
69
76
The parser is optimized for performance through:
@@ -110,6 +117,12 @@ Row,id,name,email
110
117
]
111
118
```
112
119
120
+ ### JSONL Format
121
+ ``` json
122
+ {
"table_name" :
" users" ,
"rows" : [{
"row_number" :
1 ,
"data" : {
"id" :
" 1" ,
"name" :
" John Doe" ,
"email" :
" [email protected] " }}]}
123
+ {
"table_name" :
" users" ,
"rows" : [{
"row_number" :
2 ,
"data" : {
"id" :
" 2" ,
"name" :
" John Doe" ,
"email" :
" [email protected] " }}]}
124
+ ```
125
+
113
126
## License
114
127
115
128
This project is licensed under the MIT License - see the LICENSE file for details.
0 commit comments