Skip to content

Rudimentary Database Engine implemented using B/B+ Trees for a Database Design course.

Notifications You must be signed in to change notification settings

0xrutvij/rioDatabaseEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rudimentary Database Engine

(DavisBase: Rio de Janeiro) ~ Using Custom Parsed subset of SQL


(1) Environment

  • Create a virtual environment with Python 3.9.7+ within a clone of this repo

    git clone https://github.com/0xrutvij/rioDatabaseEngine.git
    
    cd rioDatabaseEngine
    
    # if using virtualenv
    virtualenv venv
    
    # else
    python3 -m venv venv
    
    # then source it (*nix OSes)
    source venv/bin/activate
    
    # install all dependencies
    pip install -r requirements.txt 

(2) Launching the Application

  • Launching the SQL REPL

    python3 src/main_loop.py

    The output will be something like this!

    -------------------------------------------
    Welcome to RioDBLite
    RioDBLite Version 0.1
    ©2021 Rio DB Group
    
    Type "help;" to display supported commands.
    -------------------------------------------
    
    
    riodb>

(3) How to Start

  • run init db command only the first to initialize the database and create database files, it will create a file named rio.db in the current directory, and supports one database instance per directory.

  • Look at the commands supported and sample commands for next steps.

    riodb> init db;
  • Subsequent launches should read all tables present in the rio.db file.

  • The immediately previous version is backed up at all times to rio.db.bkp, to restore from backup, rename the bkp file to rio.db before next launch and remove any other files of the same name.

(4) Commands Supported (w/ Sample Commands)

  • clear: Clear previous input data clear;

  • create: create a new table in the database

    CREATE TABLE DOGS 
    (
        TagID int PRIMARY KEY, 
        Name text, Weight float, 
        Age int
    );
  • insert: Insert data into a particular table

    INSERT INTO TABLE
    (TagID, Name, Weight, Age) 
    DOGS 
    VALUES (933, "Rover", 20.6, 4);
  • select: Query data from the database

    SELECT * FROM DOGS;
  • update: Update data in the tables

    UPDATE DOGS SET Age=8 WHERE Name=“Rover”;
  • delete: Delete data from a table

    DELETE FROM TABLE DOGS WHERE Name=“Rover”;
  • drop: Delete table from database

    DROP TABLE dogs;
  • exit: Exit davisbase RioDB exit;

About

Rudimentary Database Engine implemented using B/B+ Trees for a Database Design course.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages