https://github.com/sqlitebrowser/sqlitedatagen
Super simple (~180 lines) Go util to generate SQLite data files filled with test data
https://github.com/sqlitebrowser/sqlitedatagen
sqlite3
Last synced: 12 months ago
JSON representation
Super simple (~180 lines) Go util to generate SQLite data files filled with test data
- Host: GitHub
- URL: https://github.com/sqlitebrowser/sqlitedatagen
- Owner: sqlitebrowser
- License: apache-2.0
- Created: 2017-08-17T12:20:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T11:01:26.000Z (about 7 years ago)
- Last Synced: 2025-04-13T22:08:55.708Z (12 months ago)
- Topics: sqlite3
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 6
- Watchers: 14
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## SQLite Data Generator
This is just a super simple utility for creating SQLite databases
filled with random data. It's not even a CLI, it just has three
variables at the top to change, then compile/run it:
* output directory for the SQLite file
* output filename for the SQLite file
* number of data rows in each table
eg:
```
outputDir = "Databases"
fileName = "72mb.sqlite"
numRows = 100000
```
A row count of 100000 makes a 72MB file (taking ~4.5 seconds) on my
(old) Linux desktop.
Adjust the variables to suit your desired target file name and
size, then run it:
```
$ go run main.go
2017/08/21 20:01:39 A SQLite database appears to be there already... removing it
2017/08/21 20:01:39 Creating new SQLite database file '/home/jc/Databases/72mb.sqlite'
2017/08/21 20:01:39 Creating tables
2017/08/21 20:01:39 # of cpu's detected: 4. Launching 4 data generation workers
2017/08/21 20:01:39 Adding data
2017/08/21 20:01:44 SQLite database generation completed
```
### Why?
I needed something to generate SQLite files of a specific size,
while tracking down a bug which looks related to the size of
files being transferred.