A simple and lightweight Python library for easy database management.
Project description
# PyEasyDB
PyEasyDB is a lightweight and simple Python library for managing a database with ease. It allows you to store and retrieve dictionaries in an SQLite database without dealing with complex database operations.
## Features
- Store Python dictionaries in an SQLite database
- Retrieve dictionaries using a unique identifier
- Automatically initializes the database table if it doesn't exist
- Easy-to-use API for quick integration
## Installation
To install PyEasyDB, use the following command:
```bash
pip install PyEasyDB
Note: Ensure you are in the project directory containing the
setup.pyfile.
Usage
1. Save a Dictionary
Use the save function to store a dictionary in the database:
from PyEasyDB import save
data = {"name": "Alice", "age": 25, "city": "London"}
save(data, "user_1")
2. Load a Dictionary
Use the load function to retrieve a dictionary from the database:
from PyEasyDB import load
retrieved_data = load("user_1")
print(retrieved_data) # Output: {'name': 'Alice', 'age': 25, 'city': 'London'}
Core Functions
save(dictionary, dict_id)
- Parameters:
dictionary(dict): The dictionary to save.dict_id(str): A unique identifier for the dictionary.
- Description: Serializes the dictionary into JSON format and stores it in the database. If an entry with the same ID exists, it will be replaced.
load(dict_id)
- Parameters:
dict_id(str): The unique identifier of the dictionary to retrieve.
- Returns: The dictionary as a Python
dictif found, otherwiseNone. - Raises:
sqlite3.Error: If a database error occurs.json.JSONDecodeError: If the retrieved data cannot be decoded as JSON.
Requirements
- Python 3.6 or higher
- SQLite (included by default with Python)
Contributing
Contributions are welcome! To contribute:
- Fork this repository.
- Make your changes.
- Submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
- RedSnows
Email: id.suzuya@email.com
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyeasydb-0.1.0.tar.gz.
File metadata
- Download URL: pyeasydb-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ac45b7fe1aae0c0be8c93d3a005fbdb12e8fb738c0b4c80e5d4b8564921a068
|
|
| MD5 |
2e6eafae3168c9a7477d063dd96fc45b
|
|
| BLAKE2b-256 |
9227edc5d796232b355f20837a9aaf6535c2308aef69cf5cfd0d371be53cda8b
|
File details
Details for the file pyeasydb-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyeasydb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e0f4c77333f2087a8707fc2d914450b0705eaa8b8e2251dfa555fa60dc8e97e
|
|
| MD5 |
22b1f88b4762a5968b537ccb016b8ea7
|
|
| BLAKE2b-256 |
a0b4b4ae58ce1e405431d35c5bb2651da59528d6d1033c19cb5c486f74b8b7f1
|