csv2sqlite converts CSV files into SQLite databases.
- Delimiters and enclosures can be any Unicode string:
<#>, an emoji, a multi-byte invisible separator. They're detected automatically, along with the line ending. - Fast, with low memory usage.
- Handles extremely large files.
sqlite-compare checks two SQLite files against each other and stops at the first difference.
Build from source, see Compilation.
Requirement is a working Go installation, see https://go.dev
csv2sqlite.
make csv2sqlite
# or for mac
make csv2sqlite_macsqlite-compare.
make sqlite-compare| Name / Shorthand | Default | Usage |
|---|---|---|
|
false |
Prints the version |
|
Input CSV file |
|
|
Output CSV (or SQLite) file |
|
|
Set the delimiter in case auto-detect should not be used. Can be one of:
|
|
|
Set the enclosure in case auto-detect should not be used, can be one of:
|
|
|
0 |
The starting position where the header is, useful for CSVs produced by Excel. Only works in combination with newline delimited, -nd enabled if set. |
|
-1 |
Rows to skip after the header |
|
-1 |
Amount of rows to process |
|
Sets the delimiter to use to a literal string, if set the --delimiter is ignored |
|
|
Sets the enclosure to use to a literal string, if set the --enclosure is ignored |
|
|
false |
CSV file was produced by PHP, enclosure escaped by backslash |
|
[] |
Column indices to exclude from conversion |
|
Set the newline to be used in case auto-detection should not be used. Can be one of:
|
|
|
false |
Output SQLite file |
|
false |
Input CSV is newline delimited and does not have newlines in the middle of a field |
|
15000 |
Causes the sqlite writer to stop writing at the specified amount of rows. Can cause the merge to be triggered earlier. The first writer stops at N/3 |
|
5000 |
Flush rate for comitting rows to disk |
|
15625 |
Buffer size for reading from disk in kilobytes |
|
16 |
Threads to use when writing output, default is set to the amount of cores |
|
8000 |
Buffered channels capacity multiplied by threads |
|
10 |
Chunksize before pushing the data to the channel |
|
Filename for a cpu-profile ouput for pprof |
|
|
Filename for a heap-profile ouput for pprof |
|
|
Filename for a trace profile for go tool trace |
|
|
Filename for a fgprofile ouput for pprof, see https://github.com/felixge/fgprof |
|
|
0 |
Logs the header for the collected data, pass 1 to output it. Can be used together with seq |
|
false |
Quiet mode do not output performance data |
|
false |
Performance data output in TSV format, default is JSON |
|
false |
EOL character (CR/CRLF/LF) doesn’t change after auto-detect |
|
false |
Drops all outgoing data, for perf testing disk reading |
|
false |
When the order of the CSV file must be kept the same in the resulting SQLite, this flag will cause each row in the SQLite to receive a RowID for SQLite. |
|
false |
Shows progress |
|
Directory for storing the smaller SQLite files before merging them to the target. Same as output if left blank. |
|
|
false |
Outputs debug information, careful is extremely chatty. |
|
false |
Outputs record writer debug information, careful is extremely chatty. |
|
false |
Logs the occurence and data where the Go built-in CSV Reader is used. Can be used without the debug mode. |
|
false |
Outputs dropped data |
|
false |
Overflows the data. Will abort processing. |
| Name / Shorthand | Default | Usage |
|---|---|---|
|
SQLite file A to compare with |
|
|
SQLite file B to compare against |
|
|
data |
Table to compare |
|
false |
If null is set to false it compares using TEXT fields and a NULL is automatically converted to an empty text field. If this is unwanted set null to be true. |
|
false |
Writes a result file. $a.passed when no difference was found. $a.failed when a difference was found, file will contain the error. |
|
false |
Shows progress |
|
false |
Ignore the rowcount, show the rows that are different |
|
0 |
Maximum amount of errors to allow before exiting |
|
50000 |
Row limit per query |
|
false |
Do not ignore CRLF difference from A |
|
false |
Do not ignore CR difference from A |
|
false |
Do not strip enclosures from both to ignore |
|
false |
Do not ignore incorrect detected enclosures from A to B (PHP parsing error) |
|
false |
Do not order data for indexed columns |
|
false |
Do not intersect on column names when they differ |
|
" |
Enclosure to use |
|
16 |
Thread limit |
|
Filename for a cpu-profile ouput for pprof |
|
|
Filename for a heap-profile ouput for pprof |
Currently no additional documentation is yet available.
Inside docs/ there is a file readme.adoc which can be converted to Markdown
for Github using
README.MD.
make markdownThe only configuration available are the parameters during runtime, see ???
Run the tests with coverage:
go test -cover -coverprofile coverage.out ./... -count=1See Installation
This library follows semantic versioning.