Coder Social home page Coder Social logo

key-value-store-cli's Introduction

Introduction

This is a Command Line Interface (CLI) App built using python to implement Key-Value Store. For illustrating the concept, the key-value pair considered is-

Key - Employee ID
Value - Name

Firebase database is used to store the Data. The mode opted for the db is "Realtime Database in Test Mode".

The basic structure of the Database looks like this-

alt text

Now, Firebase provides a REST API for the database. Hence, this API is used to develop the CLI commands as illustrated -

All the commands start with - employee

alt text

Working and illustrations

Command - 1 (to list all the commands)

employee --help

alt text

Command - 2 (To add an employee, i.e to set the key-Value Pair)

employee add (employee_id) -n (employee_name)

The command inserts a new entry to the database, as shown, however if the employee_id is already there, it shows a message saying "Employee ID is already assigned to someone, use another ID "

alt text

Command - 3 (To list all the employees)

employee list-all

alt text

Command - 4 (To view a particular employee, i.e. to get the value for a particular key)

employee view (employee_id)

alt text

Command - 5 (To update the info of an employee)

employee update (employee_id) -n (name)

If the user tries to update an existing id, it does that very smoothly, however, if a value that is not in the database, is accessed, it shows a message saying "The Employee you're trying to update dosen't exist, you may add new !!"

alt text

Command - 6 (To delete a record)

employee delete (employee_id)

alt text

Steps to deploy the CLI at locally (in Windows)

System requirements - The system must have python (3.4 or later) installled in it
  1. Download the repository, and unzip it
  2. Open the PowerShell at the root directory, (the directory containg the file 'setup.py')
  3. run pip install virtualenv
  4. run virtualenv env
  5. run env\Scripts\activate
  6. Now add the path to the database to your system variables
  7. run pip install --editable .
  8. run the command employee --help

Now try to execute all the above commands mentioned!! ๐Ÿ‘ฝ ๐Ÿ‘

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.