Skip to content
/ fake2db Public

Create fake data and bulk insert it into the database

License

Notifications You must be signed in to change notification settings

syronz/fake2db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fake2DB

Go Report Card Passing GoDoc

Create fake data and bulk insert it into the database

Dependency

For generating fake data using below package https://github.com/brianvoe/gofakeit

Notes for running the app

In case the number of workers is more than chunk like below some errors maybe accused depends on mysql configuration

worker =100 
chunk_size = 1
rows = 100000

supposed errors

[mysql] packets.go:37: unexpected EOF
bad connection
error in executing the query Error 1213: Deadlock found when trying to get lock; try restarting transaction

but if chunk size is big enough it is possible to have 100 workers in the same time for instance like below

worker =100
chunk_size = 3000
CREATE TABLE students (
    id BIGINT UNSIGNED AUTO_INCREMENT,
    name VARCHAR(255) NOT NULL,
    gender ENUM('male', 'female', 'other'),
    code INT,
    dob DATE,
    address TEXT,
    created_at DATETIME,
    PRIMARY KEY (id)
);

About

Create fake data and bulk insert it into the database

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages