Skip to main content

MinuteDB is a simple local database written in Python that provides basic CRUD (Create, Read, Update, Delete) operations on a local file-based database.

Project description

MinuteDB

MinuteDB is a simple local database written in Python that provides basic CRUD (Create, Read, Update, Delete) operations on a local file-based database. It is designed to be lightweight and easy to use.

Installation

You can install MinuteDB using pip:

pip install minutedb

Usage

Importing MinuteDB

from minutedb import MinuteDB

Create an instance of MinuteDB

# Format: 
db = MinuteDB(<table_name>, <primary_key>)
# Example:
db = MinuteDB("users", "name")

If the table already exist, then the primary key need not be specified.

# Format: 
db = MinuteDB(<table_name>)
# Example:
db = MinuteDB("users")

Create items

# Format:
db.create_item({<primary_key>: <value>, <key1>: <value1>, <key2>: <value2>, ...})
# Example:
db.create_item({"name": "Alice", "age": 30, "height": 6.1})
db.create_item({"name": "Bob", "age": 20, "height": 5.7})
db.create_item({"name": "Eve", "age": 40, "height": 5.11})

Read an item

The read operation needs only the primary key to be specified.

# Format: 
db.get_item(<primary_key>)
# Example:
db.get_item("Alice")

Update an item

The update operation needs the primary key as well as the updated key-value pair(s) in dictionaly format to be specified.

# Format: 
db.update_item(<primary_key>, {<key>: <updated_value>})
# Example:
db.update_item("Alice", {"age": 31})

You can update multiple attributes also.

# Format: 
db.update_item(<primary_key>, {<key1>: <updated_value1>, <key2>: <updated_value2>})
# Example:
db.update_item("Eve", {"age": 35, "height": 5.5})

You cannot update the value of the primary key itself.

Scan to find an item

The scan operation searches the items using key-value pair in dictionaly format. The search key must not contain the the primary key attribute. The return type will be a list of dictionaries.

# Format: 
db.update_item({<key>: <value>})
# Example:
db.scan_item({"age": 40})

You can scan using multiple key-value pairs also.

# Format: 
db.update_item({<key1>: <value1>, <key2>: <value2>})
# Example:
db.scan_item({"age": 20, "height": 5.7})

Delete an item

The delete operation deletes the item from the database using only the primary key.

# Format: 
db.delete_item(<primary_key>)
# Example:
db.delete_item("Eve")

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

MinuteDB-0.0.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

MinuteDB-0.0.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for MinuteDB-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b01d36a1f9a910ef4bc5a9cd06a4335321c0b9b24f3ead4f39858f7caa9f7858
MD5 3a8eea6b8ffca3fabf3ca1622ff7b3e0
BLAKE2b-256 084249c2d8a46a500ef3b938924e23911cef0118e5ed5e03207f4c221e74c7ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: MinuteDB-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for MinuteDB-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b17b517c6d18976584efb3b61c7b65f47ccc6d489fe424b8d731907b55ecb819
MD5 92c67c1b7654e7d000759a2e5e71415f
BLAKE2b-256 012425bdf47c3e494eedb8850d5ee92ff1c94dc90561647e9d4bc39d09632223

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