Skip to main content

A lightweight in-memory database for Python — perfect for testing and prototyping.

Project description

DummyDB

DummyDB is a lightweight, in-memory Python database for testing, prototyping, and mocking database operations without installing any external database servers.

It mimics the basic behavior of real databases like MongoDB or SQLite but runs entirely in memory. Ideal for developers who want fast CRUD operations without setup overhead.

PyPI version License

Features

  • In-memory storage (no installation required)
  • Table creation and management
  • CRUD operations: insert, find, update, delete
  • Save and load database to JSON
  • Lightweight and zero-dependency
  • Perfect for unit testing, demos, and small projects

Installation

pip install mockdb

Functions

> insert(data: dict)
> find(query: dict)
> update(query: dict, new_data: dict)
> delete(query: dict)
> to_json()
> create_table(name: str)
> get_table(name: str)
> drop_table(name: str)
> save_to_file(filepath: str)
> load_from_file(filepath: str)

Example Usage

    from dummydb import Database

    # Create a database
    db = Database()

    # Create a table
    users = db.create_table("users")

    # Insert records
    users.insert({"name": "Vibhakar", "age": 17})
    users.insert({"name": "Shiju", "age": 16})

    # Query records
    print(users.find({"age": 17}))

    # Update records
    users.update({"name": "Shiju"}, {"age": 17})

    # Delete records
    users.delete({"name": "Vibhakar"})

    # Save/load
    db.save_to_file("dummydb.json")
    db.load_from_file("dummydb.json")

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

dummydb-0.1.4.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dummydb-0.1.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file dummydb-0.1.4.tar.gz.

File metadata

  • Download URL: dummydb-0.1.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for dummydb-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ed3c77d19758ba5bbd06fef408a177acc8bd7cef14f20b1ec29df2387eadf567
MD5 ff9afa56a081eeb35bf9cfbacbccc10c
BLAKE2b-256 73bf8af38e622015ffa2a412e5ca0a76f62ad008a581547655abc5959ece561e

See more details on using hashes here.

File details

Details for the file dummydb-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: dummydb-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for dummydb-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 67eba06e90efd7dbfaf0046caa93bff45866ca07e0213186d1ea22837f59287e
MD5 8e17724b47c53518b86fb0ded91eecd2
BLAKE2b-256 cb6d58534e69cf97af93fa203cd08a895a248208a6ea5112da6403e3bbf5505a

See more details on using hashes here.

Supported by

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