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.2.tar.gz (9.7 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.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pythoneasydb-0.1.2.tar.gz
  • Upload date:
  • Size: 9.7 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.2.tar.gz
Algorithm Hash digest
SHA256 efc6d9a3f6aea58b788a4bf3095eee30b5bfac9420c0691b84d39a9526d954c1
MD5 608822a27539be917e4585c115e0e2b2
BLAKE2b-256 4d499912b84ae6c47d163bcdb41d816aeb78a8fc33174f088b70681e06ae044a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pythoneasydb-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c91c8f7a33df17379b32ece8aa758b86a0f3eba470777b4877e66de8da46a7c0
MD5 74dc005f09aff1164965f552804d7e61
BLAKE2b-256 7882d4ed70da6a11caba956bb102ef61a3fbc28ea1332f0436ee0e7cdf64406a

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