Standalone Python database with tables, CRUD, and JSON persistence
Project description
PhaseDB v2
PhaseDB v2 is a standalone, pure-Python database system with tables, auto-increment IDs, CRUD operations, and JSON persistence.
It allows you to work with databases without SQLite or any external dependency. Optional ORM-style models let you define tables as Python classes.
📦 Installation
1. Local installation
If you have the PhaseDB folder locally:
pip install .
2. PyPI (after uploading)
pip install phasedb
⚡ Usage
Import and connect
import phasedb
# Create or load a database file
db = phasedb.PhaseDB("mydb.pdb")
Create a table
db.create_table("users")
Insert data
db.insert("users", {"name":"Alice","coins":100})
db.insert("users", {"name":"Bob","coins":200})
Select data
all_users = db.select("users")
rich_users = db.select("users", condition=lambda r: r["coins"] > 150)
print(all_users)
print(rich_users)
Update data
db.update("users", {"coins":999}, condition=lambda r: r["name"]=="Alice")
Delete data
db.delete("users", condition=lambda r: r["name"]=="Bob")
🧱 Using Models (ORM-style)
from phasedb.models import BaseModel
class User(BaseModel):
table_name = "users"
columns = ["name", "coins", "level"]
user_model = User(db)
# Insert using model
user_model.insert(name="Charlie", coins=500, level=1)
# Select using model
print(user_model.select())
# Update
user_model.update({"coins":600}, condition=lambda r: r["name"]=="Charlie")
# Delete
user_model.delete(condition=lambda r: r["name"]=="Charlie")
🔹 Features
- Fully standalone (no SQLite)
- Tables with auto-increment IDs
- Pythonic CRUD:
insert,select,update,delete - JSON persistence for saving/loading data
- Optional ORM-style models for cleaner table management
- Simple, readable Python API
🔧 Requirements
- Python 3.8+
- No external dependencies
📌 License
MIT License
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
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 phasedb-2.0.1.tar.gz.
File metadata
- Download URL: phasedb-2.0.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
558de78ee4eb8cd4d0fe9aad66de3d0f70958d1203929d8f173bc2c8c9eddbd7
|
|
| MD5 |
2740bd9c7d9140a85de72ff9edf6fa41
|
|
| BLAKE2b-256 |
acdee6813197fe9c67339925229de6f31ad22e9cbe04579591fbad5bb9d4655d
|
File details
Details for the file phasedb-2.0.1-py3-none-any.whl.
File metadata
- Download URL: phasedb-2.0.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e22d5dcc32950037888ea314cc684ce678fe848c5bc6d8faccdb438aee719d3
|
|
| MD5 |
30fefd9ac8ea0d532a1420a07319db78
|
|
| BLAKE2b-256 |
7ed8f1961898eebda51072ee17a3fc8a48e658c544cb11c16b751435a320250b
|