Coder Social home page Coder Social logo

simpledb's Introduction

Info:

Name: Arthur Papailhau

Mail: [email protected]

SimpleDB

Python version: python 3.5

Data Commands

Your database should accept the following commands:

  • SET name value – Set the variable name to the value value. Neither variable names nor values will contain spaces.
  • GET name – Print out the value of the variable name, or NULL if that variable is not set.
  • UNSET name – Unset the variable name, making it just like that variable was never set.
  • NUMEQUALTO value – Print out the number of variables that are currently set to value. If no variables equal that value, print 0.
  • END – Exit the program. Your program will always receive this as its last command.

Transaction Commands

In addition to the above data commands, your program should also support database transactions by also implementing these commands:

  • BEGIN – Open a new transaction block. Transaction blocks can be nested; a BEGIN can be issued inside of an existing block.
  • ROLLBACK – Undo all of the commands issued in the most recent transaction block, and close the block. Print nothing if successful, or print NO TRANSACTION if no transaction is in progress.
  • COMMIT – Close all open transaction blocks, permanently applying the changes made in them. Print nothing if successful, or print NO TRANSACTION if no transaction is in progress.

Run

Input from standard input (stdin)

  • python3 SimpleDB.py < test_input/test3.txt

Input from the user

  • python3 SimpleDB.py

Test

In the test_input directory, there are 6 different tests.

Design

  • The name:value are stored in a dict()
  • The transactions are implememted with a Stack (Array of Dict())
  • The number of variables that are currently set to value are implemented with a dict()

simpledb's People

Contributors

papay0 avatar

Watchers

James Cloos avatar  avatar

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.