Skip to main content

dbjson is a module that can help you use json as database

Project description

dbjson

Get started

things that you need:


  • Python

    • of course you need it

Installation


$- pip install dbjson

What is dbjson?


dbjson is Python module

Everyone say JSON can't be used as database but I don't think JSON can't be used as database

With this module you can use JSON as database since JSON is just Python dictionary

Example Code


Creating json file

import dbjson as db

db.new('database')

Add a data inside our database

db.data().new('database','data1','value1')

If you open the JSON file you can see that JSON file will automatically update

//Before
{}
//After
{"data1": "value1"}

How about we want to edit the data?

Well,you can use rewrite method

db.data().rewrite('database','data1','value2')

check the JSON file

//Before
{"data1": "value1"}
//After
{"data1": "value2"}

To remove data we use remove method

db.data().remove('database','data1')
//Before
{"data1": "value2"}
//After
{}

To remove all the data in our database,we use end method

db.data().end('database')

Quicklinks


Github

Discord Server

License


MIT License

Copyright (c) 2021 muhammad184276@gmail.com


Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DBJSONS-1.0.2.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

DBJSONS-1.0.2-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page