Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythoneasydb-0.1.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythoneasydb-0.1.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file pythoneasydb-0.1.0.tar.gz.

File metadata

  • Download URL: pythoneasydb-0.1.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pythoneasydb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 79eee86bec6f4775f29452aaec2bc280ccd267a307c405fc21e495f811e5acd6
MD5 77db5caa15712d5e1d14e754c39de656
BLAKE2b-256 f1bd88bf8f1900ca2f26d0604c2eb041cdb4d6f2f5d2d5c66accec30f5c400c4

See more details on using hashes here.

File details

Details for the file pythoneasydb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pythoneasydb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pythoneasydb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bd065815e1e1d6c7a10cecfcc56ab154642db91e0765358a9112d182e3b7ae4
MD5 343ba70bdaf2e48368521cbf1935cffd
BLAKE2b-256 18cac49b889e40f3b1489204c50dda7d8afa7bb5af41b3ab721f8b6a7832ad7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page