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.1.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: MinuteDB-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 8cd32bc88f11e21d963d2a3a0da73ac2c532aa79a5a65224d5594b6836e19bc3
MD5 6c25c282631f5bac6a620bd514ab78ac
BLAKE2b-256 55ec5e1a9623c80fcfe21b1c35fd30ca7011618c7b1d048d2825320fa1127931

See more details on using hashes here.

File details

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

File metadata

  • Download URL: MinuteDB-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a47739265d149c2d0eae7befd9010061d15aadb1eb318c7bfee914ad5a697df
MD5 99c005f2789826e40816ac6a31c0b22a
BLAKE2b-256 560ce90dbbc9401b0fca607d219267af731bfbe94376cfc5c8986ac29dd98f4a

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