Skip to content

A CLI app built using python to implement key-value store

Notifications You must be signed in to change notification settings

aimanfatima/key-value-store-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!! 👽 👍

About

A CLI app built using python to implement key-value store

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages