Giter Club home page Giter Club logo

sql-generator's Introduction

SQL Generator

The idea of this project is to quickly generate mock data given the table schema for testing.

The user will provide a sql file with CREATE TABLE query, the program will then generate the INSERT queries with randomized values.

The following key types are support:

  • Int
  • Float

To build and run:

cargo run --package sql_gen --bin sql_gen

Usage: sql_gen <IN_FILENAME> <ROW> <OUT_FILENAME>

Demo

cargo run --package sql_gen --bin sql_gen create_table_example.sql 10 out_demo.sql
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/sql_gen create_table_example.sql 10 out_demo.sql`
sucess!

Input create_table_example.sql

CREATE TABLE Example (
    key1 int,
    key2 float,
    key3 int,
);

Output out_demo.sql

INSERT INTO Example (key1,key2,key3) VALUES (570080915,0.3326017107395912,2041731471);
INSERT INTO Example (key1,key2,key3) VALUES (-1621816396,0.2504709833380463,-893641627);
INSERT INTO Example (key1,key2,key3) VALUES (2026367375,0.11187439747243,-973716815);
INSERT INTO Example (key1,key2,key3) VALUES (-397045788,0.45414665478686056,-1058334232);
INSERT INTO Example (key1,key2,key3) VALUES (-1271435317,0.21013061553028045,805791500);
INSERT INTO Example (key1,key2,key3) VALUES (174026881,0.39741794428100174,992559332);
INSERT INTO Example (key1,key2,key3) VALUES (-618916610,0.09780515473024087,-418273415);
INSERT INTO Example (key1,key2,key3) VALUES (1426348933,0.34229022904164663,2016457394);
INSERT INTO Example (key1,key2,key3) VALUES (-1754188540,0.9170772713421181,-386679943);
INSERT INTO Example (key1,key2,key3) VALUES (58019886,0.03461671459436921,1363563167);

sql-generator's People

Contributors

vertexc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.