View on GitHub

PySQL

Python wrapper for making MySQL queries easier

PySQL

Python wrapper for making MySQL queries easier to execute


Installation

git clone https://github.com/Devansh3712/PySQL.git

Windows

pip install pysql-cli

Linux / MacOS

pip3 install pysql-cli

Open the PySQL directory and run the install file

Windows

install.bat

Linux / MacOS

chmod +x ./install.sh
./install.sh

Open the PySQL directory

using requirements.txt

pip install -r requirements.txt

Usage

pysql
cpysql

Windows

python pysql/main.py
python pysql/main_c.py

Linux

python3 pysql/main.py
python3 pysql/main_c.py

Commands

List of available commands

ALL COMMANDS

    select              TB_NAME, COLUMNS, ARGS      Displays selected columns of a table
    insert      -s      TB_NAME, ARGS               Insert a single row in a table
                -m      TB_NAME, NUM, ARGS          Insert `NUM` rows in a table
                -f      TB_NAME, FILE_NAME          Insert values in a table from CSV file
    update              TB_NAME, COLUMNS, ARGS      Updates values of columns in a table
    delete              TB_NAME, COLUMN             Deletes values of row in a table
    showdb                                          Display all databases in MySQL server
    usedb                                           Use a database
    createdb            DB_NAME                     Create a new database
    dropdb              DB_NAME                     Delete a database
    showtb                                          Display all tables in current db
    createtb            TB_NAME, ARGS               Create a new table in current db
    droptb              TB_NAME                     Delete a table in current db
    trunctb             TB_NAME                     Truncate a table in current db
    desctb              TB_NAME                     Display structure of a table in current db
    altertb             TB_NAME, ARGS               Alter contents of table in current db
    exportdb            DB_NAME, PATH               Export db as `.sql` file to path
    exporttb    -json   TB_NAME, PATH               Export table as `.txt` file to path
                -csv    TB_NAME, PATH               Export table as `.csv` file to path
                -sql    TB_NAME, PATH               Export table schema as `.sql` file to path
    exportall   -json   PATH                        Export all tables in db as `.txt` file to path
                -csv    PATH                        Export all tables in db as `.csv` file to path
                -sql    PATH                        Export all tables schema in db as `.sql` file to path
    importdb            DB_NAME, PATH               Import `.sql` file into input database
    importtb            DB_NAME, PATH               Import `.sql` table schema into input table