Skip to main content

Lightweight JSON Database for Python

Project description

What is this?

LightDB is a simple and lightweight JSON database for Python that allows users to efficiently write data to a file. It is designed to be easy to use, making it a great choice for developers who need a fast and reliable way to store and retrieve data.

Features

  • Lightweight: LightDB is a lightweight database that is implemented as a Python dictionary, making it simple and easy to use.

  • Simple API: LightDB provides a simple and intuitive API that allows users to easily set, get, and remove key-value pairs in the database.

  • JSON file storage: LightDB stores its data in a JSON file, making it easy to read and edit the database outside of the Python environment.

  • Nested dictionaries: LightDB supports nested dictionaries, allowing users to organize their data in a hierarchical structure.

  • Persistance: LightDB’s data is persisted in the JSON file, ensuring that it is retained between program runs.

  • Reset: LightDB provides a reset method that allows users to clear the database and start fresh.

  • Type agnostic: LightDB is type-agnostic, meaning it can store any Python object as a value in the database.

  • Portable: LightDB can be easily transferred between different systems, making it a great choice for simple data storage needs.

Simple usage

from lightdb import LightDB

# Create a new database object, or load an existing one from file
db = LightDB("my_database.json")

# Set a key-value pair
db.set("name", "Alice")

# Get the value associated with a key
name = db.get("name")
print(name)  # Output: "Alice"

# Set a key-value pair in a nested dictionary
db.set_key("person", "age", 30)

# Get the value associated with a key in a nested dictionary
age = db.get_key("person", "age")
print(age)  # Output: 30

# Remove a key-value pair from the database
db.pop("name")

# Remove a key-value pair from a nested dictionary
db.pop_key("person", "age")

# Reset the database to an empty state
db.reset()

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

LightDB-1.4.0.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file LightDB-1.4.0.tar.gz.

File metadata

  • Download URL: LightDB-1.4.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for LightDB-1.4.0.tar.gz
Algorithm Hash digest
SHA256 425d39051e28cb736a9cdc3d65c8c6b14a4578339008348a0a59448cec82f430
MD5 535f5fe1addbde68109acc56ecc517df
BLAKE2b-256 b7ed0a7141812d24595fe234c6bf81e4c6b99246016db8d26e96e23a8758c3e0

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