Skip to content

ruchir594/json-db-database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a JSON Database system for Python.

It builds a database in JSON. This great light weight programming is a better way to quick prototyping, and testing. It can also be used in production with software that require storing some form of context, but does not require a huge scalable database.

How to use it?

Define your database structure in "template.json". Look for example.

The first column is the name of column, the second column will specify the type such as, number, string, array, or a bool

Example

template.json

{
  "columns": [
    ["unique id", "number"],
    ["some column name", "string"],
    ["other column name", "string"],
    ["one more column", "array"],
    ["a column", "bool"]
  ]
}

test.py

from jsondb import manage_element

dbfile = 'data.json'
manage_element.init_json(dbfile, 'trial')

a = manage_element.get_element(dbfile,'103')
a['other column name'] = 'Testing on Oct 21'
a['one more column'] = ['the', 'beatles', 21]
manage_element.update_element(dbfile, a)

print manage_element.get_element(dbfile,'103')

Output

$ python test.py
{u'one more column': [u'the', u'beatles', 21], u'unique id': -1, u'other column name': u'Testing on Oct 21', u'some column name': u'', u'a column': u'False', u'id': u'103'}

About

A quick, easy database in JSON. For prototyping, testing, and publishing in small applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages