Unified Python database client for SQLite, PostgreSQL, MongoDB, and Redis.
Project description
🗉 PythonEasyDB
PythonEasyDB — bu Python kutubxonasi bo‘lib, u bir nechta turdagi ma'lumotlar bazalariga yagona interfeys orqali ulanish imkonini beradi:
✅ SQLite
✅ PostgreSQL
✅ MongoDB
✅ Redis
Ushbu kutubxona SQL yozmasdan, yuqori darajadagi (high-level) API orqali qulay ishlash imkonini beradi.
🚀 O‘rnatish
pip install PythonEasyDB
Yoki manba koddan:
git clone https://github.com/asrorbekaliqulov/PythonEasyDB.git
cd unidb
pip install .
📆 Qo‘llab-quvvatlanadigan bazalar
| Engine | Ulash uchun URI namunasi |
|---|---|
| SQLite | sqlite:///path/to/db.sqlite3 |
| PostgreSQL | postgresql://user:password@localhost/db |
| MongoDB | mongodb://localhost:27017/db |
| Redis | redis://localhost:6379 |
⚡️ Quick Start
from PythonEasyDB import easydb
# SQLite bilan ulanish
db = easydb("sqlite:///mydb.sqlite3")
# Jadval yaratish
db.create_table(
"users",
id={"type": "int", "primary_key": True, "auto_increment": True},
name={"type": "str", "not_null": True},
age="int",
active={"type": "bool", "default": True}
)
# Ma'lumot qo‘shish
db.insert("users", {"name": "Asrorbek", "age": 20})
# Ma'lumot olish
users = db.select("users", where={"age__gte": 22}, order_by="name", desc=True)
print(users)
📘 API Hujjatlari
✅ create_table
create_table(table_name, **columns)
columns dictionary formatda bo‘lishi kerak:
{
"id": {
"type": "int",
"primary_key": True,
"auto_increment": True,
"not_null": True,
"unique": True,
"default": 1,
"foreign_key": ("other_table", "column"),
"on_delete": "cascade"
}
}
✅ insert
insert(table_name, data)
Misol:
db.insert("users", {"name": "Ali", "age": 20})
✅ select
select(
table_name,
where=None,
order_by=None,
desc=False,
limit=None,
offset=None,
group_by=None,
having=None,
distinct=False,
joins=None
)
Qo‘llab-quvvatlanadigan where operatorlari:
| Operator | Tavsif | Misol (where={}) |
|---|---|---|
eq |
tenglik | "age__eq": 20 |
ne |
teng emas | "age__ne": 30 |
lt/lte |
kichik/≤ | "age__lt": 18 |
gt/gte |
katta/≥ | "age__gte": 16 |
in |
ro‘yxatda | "id__in": [1,2,3] |
like |
LIKE qidiruv | "name__like": "%Ali%" |
isnull |
NULL tekshiri |
"email__isnull": True |
✅ update
update(table_name, where, values)
Misol:
db.update("users", where={"id": 1}, values={"name": "Ali"})
✅ delete
delete(table_name, where)
Misol:
db.delete("users", where={"age__lt": 16})
✅ close
db.close()
Bazani yopish uchun.
✅ Moslik (Compatibility)
- Python 3.7+
- SQLite 3+
- PostgreSQL 10+
- MongoDB 4.0+
- Redis 5+
🛠 Hissa qo‘shish (Contributing)
git clone https://github.com/asrorbekaliqulov/PythonEasyDB.git
cd PythonEasyDB
python3 -m venv venv
source venv/bin/activate
pip install -e .[dev]
pytest
Pull request yuborishdan oldin testlar ishlashiga ishonch hosil qiling.
📜 Litsenziya
Ushbu loyiha MIT litsenziyasi ostida.
📬 Muallif
Asrorbek Aliqulov
📧 Email: asrorbekaliqulov08@gmail.com
🌐 Sayt: https://asrorbekaliqulov.uz
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 pythoneasydb-0.1.1.tar.gz.
File metadata
- Download URL: pythoneasydb-0.1.1.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cd1c83b1387811586ceda10fafd081ceef2949005b773f102d81eec593b254c
|
|
| MD5 |
fa4313ce3869fd817b1e856c78fb5e3e
|
|
| BLAKE2b-256 |
bf32ca01d269806a945578167c837ba6d09a3e2b8751e74f848a09e0003dd080
|
File details
Details for the file pythoneasydb-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pythoneasydb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d20c95591ab2f00246c53b017d7b216269d09e96f2a2643cf509a097bd2b0822
|
|
| MD5 |
3d6cdb887eec3f86f741734b8c25cd29
|
|
| BLAKE2b-256 |
2ef96b4c0beb6e24f9f372541954aec931940223c3fa88461cddbd63c93aa16f
|