Datagoose, JSON Based Database for Best Performance.
Tags: python, json, database
Published: 2021-05-10 19:02:43

**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](https://github.com/5elenay/datagoose)

# Download
You can download with `pip install -U datagoose` ([PyPi Page](https://pypi.org/project/datagoose/)) or, you can use with source code.

# Documentation
- [Quick Documentation](https://github.com/5elenay/datagoose/blob/main/README.md#quick-documentation)
  - [Quick Start](https://github.com/5elenay/datagoose/blob/main/README.md#quick-start)
  - [Inserting Data](https://github.com/5elenay/datagoose/blob/main/README.md#inserting-data)
  - [Finding Data](https://github.com/5elenay/datagoose/blob/main/README.md#finding-data)
  - [Updating Data](https://github.com/5elenay/datagoose/blob/main/README.md#updating-data)
  - [Replace Data](https://github.com/5elenay/datagoose/blob/main/README.md#replace-data)
  - [Deleting Data](https://github.com/5elenay/datagoose/blob/main/README.md#deleting-data)
  - [Count & Exists](https://github.com/5elenay/datagoose/blob/main/README.md#count--exists)
  - [Regex Example](https://github.com/5elenay/datagoose/blob/main/README.md#using-regex)
  - [Load & Dump](https://github.com/5elenay/datagoose/blob/main/README.md#load--dump)
  - [Copying Data](https://github.com/5elenay/datagoose/blob/main/README.md#copying-data)
  - [Collecting Garbage Data](https://github.com/5elenay/datagoose/blob/main/README.md#collecting-garbage-data)
  - [Sorting Data](https://github.com/5elenay/datagoose/blob/main/README.md#sorting-database)
  - [Auto Backup](https://github.com/5elenay/datagoose/blob/main/README.md#auto-backup)
  - [Events](https://github.com/5elenay/datagoose/blob/main/README.md#using-events)

# 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
```py
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)
```