Skip to main content

This is a simple flat file database which stores its data in a JSON file. It is NOT INTENTED TO USE IN PRODUCTION. It can be used times when you are too lazy to write a schema and do other stuff for a ORM like SQLAlchemy. Data is structured in simple format of collections and records ( key-value pairs ).

Project description

Getting started with DBJson

from dbjson.main import DB

# Instatilizing DB class from dbjson.main
db = DB()

# Test Data
data = {
  "id": 1,
  "first_name": "Vivyan",
  "last_name": "Treherne",
  "email": "vtreherne0@jigsy.com",
  "ip_address": "94.254.247.240"
}
collection = "users"

# Adding Record
data = db.createRecord(collection, data)
print(data)
# Response -> {'__id__': 'f00ae4e3ca8c3e318a68acc460e5f401', '__data__': {'id': 1, 'first_name': 'Vivyan', 'last_name': 'Treherne', 'email': 'vtreherne0@jigsy.com', 'ip_address': '94.254.247.240'}}

# Updating Record
record_key = "f00ae4e3ca8c3e318a68acc460e5f401"
to_update = [
    {"email": "jhon@email.com"},
    {"ip_address": "google.com"}
]
data = db.updateRecord(collection, "f00ae4e3ca8c3e318a68acc460e5f401", to_update)
print(data)
# Response -> {'id': 1, 'first_name': 'Vivyan', 'last_name': 'Treherne', 'email': 'jhon@email.com', 'ip_address': 'google.com'}

# Deleting Record
db.removeRecord(collection, record_key)

What is DBJson?

Read the DBJson docs here .

This is a simple flat file database which stores its data in filesystem ( folders and JSONfiles ). It is NOT INTENTED TO USE IN PRODUCTION. It can be used times when you are too lazy to write a schema and do other stuff for a ORM like SQLAlchemy.

Data is structured as follows:

Collections : contains records. records: contains key value pair. key value pair ( key: str, value: dictionary ).

What are its features ?

It can CRUD data. It is ACID Compliant.

What can it Do ?

It can do all the basic things that a database can do, which includes:

  1. creating records
  2. reading records
  3. updating records
  4. deleting records
  5. filter records

Why was it made ?

Sometimes I am to lazy to setup database make database models and all that stuff, and I like key-value pair databases for small fun projects. So I could not find in python so I decided to make one for myself.

Hope you guys like it.😊

Read the DBJson docs here .

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

dbjson-0.0.3.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

dbjson-0.0.3-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file dbjson-0.0.3.tar.gz.

File metadata

  • Download URL: dbjson-0.0.3.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for dbjson-0.0.3.tar.gz
Algorithm Hash digest
SHA256 39f893054ba9e2b9d26745cdf2e08efc9a4efeca4b8019b15f349c6970cbb9e2
MD5 7d27081ef067c20b7040739692f7627a
BLAKE2b-256 09e816a9953c0b79e22179fde9cdec9f92bbebe58170c543e884142974825dbd

See more details on using hashes here.

File details

Details for the file dbjson-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: dbjson-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for dbjson-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0307aff60a34e84f46c77250f7b0785be84fb1f12a5889fe060d4c1f10616fa4
MD5 ebee19dff72750554abc65f3906d5bf5
BLAKE2b-256 bba75da0b9a373764dd2cc0ab9f77d62c58630a766f08afe46d2421264476404

See more details on using hashes here.

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