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:
```bash
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
phasedb-2.0.0.tar.gz
(4.4 kB
view details)
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.0.tar.gz.
File metadata
- Download URL: phasedb-2.0.0.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 |
64ac9665a5945a61972adb2ee52d27f83502b364f90d570064efa2bbb43dabb2
|
|
| MD5 |
6db2b2ca0fb37380d26f155f6cd8bbcc
|
|
| BLAKE2b-256 |
47d66b20afe40f6627a53fee354a3bb7a9bd989adfed3e86d35e35062dcf3da9
|
File details
Details for the file phasedb-2.0.0-py3-none-any.whl.
File metadata
- Download URL: phasedb-2.0.0-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 |
d7f4a51c1938c55830ea742f12b3bc773dfafe1da408759ddace454ccd30bd92
|
|
| MD5 |
202fc87d092e57cda7b6ad7615394a80
|
|
| BLAKE2b-256 |
92140b408f29e3ea3672a29965848e5de4bbb32c45677c88a9d34240a31a4e86
|