Zeptum
A simple Python-based database library for managing hierarchical data with tables, where each table can have nested keys and values. This project allows you to create tables, input or update data, delete tables, and retrieve data based on a table and key.
Features
- Create Tables: Easily create new tables.
- Insert/Update Data: Input or update values at hierarchical keys.
- Retrieve Data: Retrieve data by table and key.
- Delete Tables: Delete a table and its contents.
- Clear Tables: Clear all data in a table without deleting it.
Installation
There is no installation required if you are using the Python code directly. Simply clone or download the repository and use it in your Python project.
- Clone the repository or install from pypi.
git clone https://github.com/yourusername/simple-database.git
- Install from pypi:
pip3 install zeptum
- Use it in your Python project.
Usage
To use the zeptum, import the ClientBase class and follow the examples below.
Example
# Import the SimpleDatabase class
from zeptum import ClientBase
# Initialize the database
db = SimpleDatabase()
# Create a table
db.create_table("user")
# Insert or update data
db.input("user", "money.balance", 100)
db.input("user", "money.count", 50)
# Retrieve data
balance = db.get_data("user", "money.balance")
print(balance) # Output: 100
# Update existing data
db.update("user", "money.balance", 200)
# Retrieve updated data
updated_balance = db.get_data("user", "money.balance")
print(updated_balance) # Output: 200
# Delete a table
db.delete_table("user")
# Retrieve data after table deletion
deleted_balance = db.get_data("user", "money.balance")
print(deleted_balance) # Output: None
Methods
-
create_table(table_name: str):- Creates a new table in the database if it doesn’t already exist.
-
input(table_name: str, key: str, value: Union[str, int, float, Dict]):- Inserts or updates the value at the specified key in the given table.
- Example key format:
"money.balance","user.name".
-
get_data(table_name: str, key: str) -> Optional[Union[str, int, float, Dict]]:- Retrieves the value at the specified key in the table.
- Returns
Noneif the table or key does not exist.
-
update(table_name: str, key: str, value: Union[str, int, float, Dict]) -> bool:- Updates an existing value in the specified table and key.
- Returns
Trueif the update was successful,Falseif the key doesn’t exist.
-
delete_table(table_name: str) -> bool:- Deletes the entire table from the database.
- Returns
Trueif the table was deleted,Falseif the table does not exist.
-
clear_table(table_name: str) -> bool:- Clears all data in the specified table without deleting the table itself.
- Returns
Trueif the table was cleared,Falseif the table does not exist.
-
show():- Returns the entire database as a dictionary.
-
Donwloads from pypi:
pip3 install zeptum
- Run the code:
python3 main_db.py
License
This project is open-source and available under the MIT License.
Contributing
If you'd like to contribute to the development of this library, feel free to fork the repository and submit a pull request. Contributions are welcome!
Metadata
Release files for zeptum 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| zeptum-1.0.1.tar.gz | 3.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zeptum-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / zeptum-1.0.1.tar.gz
| Download URL | zeptum-1.0.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0970c959fabee639a85a793805744e2cd56cc54572d9d948a252e5634b789160
|
|
BLAKE2b-256 checksum How to use checksums |
7da286b29b00c1a81527c1ed4e9a4d9f5f063f0a904ec900c2313376a0485e8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.3
|
Release files / zeptum-1.0.1-py3-none-any.whl
| Download URL | zeptum-1.0.1-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8bbd6573231f908eda55d9b0d83b859009252a709d4fd1d2bc98a2fdc5c251d3
|
|
BLAKE2b-256 checksum How to use checksums |
92baf33f9c90ca8d2ebcd38db2240c82ab0f44713980278e35545f6a8c1c4ec5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.3
|
Security for zeptum 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.