Databases should be Effortless.
Project description
Databases should be Effortless.
Effortless has one objective: be the easiest database. It's perfect for beginners, but effortless for anyone.
Quickstart
You can install Effortless easily, if you have pip and Python 3.9 or higher installed.
pip install effortless
Usage
We offer 3 tiers of effort when using our databases. If this is your first time using a database, try out the Effortless usage below. If you are working on a simple project, you should take a look at the Basic usage docs. Overachievers may want to try our Advanced features.
Effortless Usage
from effortless import db
# Add items to the database
db.add({"name": "Alice", "age": 30})
db.add({"name": "Bob", "age": 25})
# Search for items
result = db.search({"name": "Alice"})
print(result) # Output: {'1': {'name': 'Alice', 'age': 30}}
# Get all items
all_items = db.get_all()
print(all_items)
# Output: {'1': {'name': 'Alice', 'age': 30}, '2': {'name': 'Bob', 'age': 25}}
# Wipe the database
db.wipe()
print(db.get_all()) # Output: {}
Basic Usage
from effortless import Effortless
# Create a new Effortless instance
db = Effortless()
# Add items to the database
db.add({"name": "Charlie", "age": 35})
db.add({"name": "David", "age": 28})
# Search for items
result = db.search({"age": 28})
print(result) # Output: {'2': {'name': 'David', 'age': 28}}
# Get all items
all_items = db.get_all()
print(all_items)
# Output: {'1': {'name': 'Charlie', 'age': 35}, '2': {'name': 'David', 'age': 28}}
Advanced Usage
from effortless import Effortless
# Create a new Effortless instance with a custom directory
db = Effortless("advanced_db")
db.set_directory("/path/to/custom/directory")
# Add multiple items
db.add({"id": 1, "name": "Eve", "skills": ["Python", "JavaScript"]})
db.add({"id": 2, "name": "Frank", "skills": ["Java", "C++"]})
db.add({"id": 3, "name": "Grace", "skills": ["Python", "Ruby"]})
# Complex search
python_devs = db.search({"skills": "Python"})
print(python_devs)
# Output: {'1': {'id': 1, 'name': 'Eve', 'skills': ['Python', 'JavaScript']},
# '3': {'id': 3, 'name': 'Grace', 'skills': ['Python', 'Ruby']}}
# Update configuration
db.configure({"index_fields": ["id", "name"]})
# Wipe the database
db.wipe()
print(db.get_all()) # Output: {}
Why Effortless?
Not only is storing, retrieving, and managing data is as simple is it can be, Effortless is also:
- Cross platform
Effortless DBs work on any device supporting Python and DBs can be copied across devices.
- Safe
All DB data is safe, lossless, local, and recoverable by default.
- Scaling
Our DBs have deep code support for batch functions.
- Clear
We take pride in our documentation, so that learning takes minimal effort.
-
Broad
All that's required to use Effortless is Python >= 3.9.
- Compact
Our code is compact, both in package size, dependencies, and db size.
Contributing
Writing code takes a lot of effort! Check out CONTRIBUTING.md for information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Effortless-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c553d7c27b714611f5487112eda455f3e89526238ebc80bc993b012404725df8 |
|
MD5 | 78089f9432d8e856201e97151d873a63 |
|
BLAKE2b-256 | 05f5006eda1458ba48c11f5766f89df40dbd05ed0b8bfb1733aa605b9d0bd227 |