YashKumarVerma / go-do-sql

a handy cli application to generate and populate tables and data. Written for personal use in DBMS labs
MIT License
5 stars 0 forks source link

go-do-sql

Build package

This project is an attempt to vent out the grudges against common education practices that focus on everything but skill development.

What this does / features

This is a command line application (CLI) which makes it easy to generate sql tables and fill dummy data without pain.

Features

Supported Fill options

Working

After running the application, enter the name of the table as requested. Table name is required because many commands require an explicit table name, the most important one being create table

https://i.imgur.com/9mYVyNI.png

The data can be selected from any of the above mentioned categories. https://i.imgur.com/eqJ8GAf.png

When you have entered the data and can't wait any longer, enter exit https://i.imgur.com/HgDl5E7.png

Once you exit the shell, the cli generates the data for you. You can inspect the commands in the terminal itself, https://i.imgur.com/cAHlvax.png

Often it might be problematic to copy from terminals due to various reason, therefore all the generated data can be found in the /output directory. All the files start with the table name as prefix, so do not worry about collisions.

https://i.imgur.com/dZx8YgD.png

The *`.insert.template.txt`** contains a single line with columns you need to insert while filling data manually. https://i.imgur.com/UR5bqLG.png

If you want to access the random data generated by the cli, view the *`.insert.filled.txt`** file. By default 10 entries are created. https://i.imgur.com/GvPokwf.png

You might need the commands to create table, afterall, that's the reason we specified details of the columns. The table creation command is located in *`.table.txt`** file. https://i.imgur.com/197prVV.png

CREATE TABLE users (
    id INT(8) NOT NULL AUTO_INCREMENT , 
    name VARCHAR(10) NOT NULL DEFAULT 'unnamed', 
    email VARCHAR(64) NOT NULL DEFAULT 'someone@example.com', 
    dob DATETIME NOT NULL , 
    country VARCHAR(30) NOT NULL , 
    zip VARCHAR(8) NOT NULL , 
    pet VARCHAR(64) NOT NULL , 
    CONSTRAINT users_primary_key PRIMARY KEY (id), 
    CONSTRAINT unique_email UNIQUE (email)
);