DEV Community

Cover image for Datagoose, JSON Based Database for Best Performance.
5elenay
5elenay

Posted on • Edited on

Datagoose, JSON Based Database for Best Performance.

Datagoose

Datagoose is an easy to use JSON based database for python.

With Datagoose:

  • Best performance. Datagoose is a lightweight database.
  • Methods that makes your job easier.
  • Regex supports.
  • Safe to use.
  • Auto or manual save, for who wants better performance.
  • Easy to use database. Created for everyone.
  • Rich options. includes hash keys, database path, garbage leak option and more.
  • Auto backup
  • Events
  • Can be dumped, also can load a data from JSON file.
    • <Datagoose>.load()
    • <Datagoose>.dump()

Source Code

Click

Download

You can download with pip install -U datagoose (PyPi Page) or, you can use with source code.

Documentation

Performance

Test Result (Auto-Save Enabled):

  • 100 Data with insert many:

    Starting Insert...
    Inserting Finished in  0:00:00.007002
    
  • 1,000 Data with insert many:

    Starting Insert...
    Inserting Finished in  0:00:00.032004
    
  • 10,000 Data with insert many:

    Starting Insert...
    Inserting Finished in  0:00:00.278020
    
  • 100,000 Data with insert many:

    Starting Insert...
    Inserting Finished in  0:00:02.808687
    
  • 1,000,000 Data with insert many:

    Starting Insert...
    Inserting Finished in  0:00:31.908481
    

Random Example Code

from datagoose import Datagoose
import random

# Getting Database
# Will create a new JSON file if not exists.
db = Datagoose("example", {
    "AUTO_SAVE": True,
    "USE_REGEX": True,
    "PATH": "dg/databases"
})

# insert many function example.
db.insert_many(*(
    {
        "NAME": random.choice(["eric", "kyle", "ike"]),
        "LAST_NAME": random.choice(["cartman", "marsh"]),
        "AGE": random.randint(9, 12),
        "POINT": random.randint(1, 10_000),
        "UID": i 
    } for i in range(10_000)
))

# find and sort function example (you can use regex.)
for res in db.find_and_sort({ "NAME": r"eric|kyle", "LAST_NAME": r"cartman", "AGE": 10 }, "POINT"):
    print(res)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)