A lightweight Mongoose-inspired SQL ORM for Python
Project description
PyDb-SQL
A lightweight, Mongoose-inspired SQL ORM for Python with a focus on developer experience, safety, and modern architectural patterns.
Features
- Declarative Schema: Define models as Python classes.
- Mongoose-like Queries: Chainable query builder with double-underscore operators (
age__gt=20). - Identity Map (Session): Ensures object uniqueness across queries.
- Dirty Tracking: Optimized
UPDATEqueries that only send modified fields. - Lazy Loading: Automatic relationship fetching via
ForeignKeyField. - Connection Pooling: Built-in support for MySQL connection pooling.
Installation
pip install pydb-sql
Quick Start
from pydb import connect, Model, StringField, IntField
# 1. Connect
connect(host="localhost", user="root", password="your_password", database="test_db")
# 2. Define
class User(Model):
name = StringField(required=True)
age = IntField(default=18)
# 3. Synchronize
User.init_table()
# 4. Use
u = User(name="Satyam", age=25).save()
print(f"Created user with ID: {u.id}")
# Query
user = User.find_one(name="Satyam")
user.age = 26
user.save() # Performs partial update
License
MIT
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
pydb_sql-0.1.0.tar.gz
(6.1 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 pydb_sql-0.1.0.tar.gz.
File metadata
- Download URL: pydb_sql-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f54fc63bf9d56521a5030b9ce9b9f73eb80e0581a1453c9ae7ed3c5b56c563b
|
|
| MD5 |
4a1ea09841bb71c306072052eb28aa41
|
|
| BLAKE2b-256 |
9da9bef1f64ed929da7436e81d4a60894d5547a6829f3a47df44aca50a548f96
|
File details
Details for the file pydb_sql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pydb_sql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c98175230b9e72d488f928dd10fba0ef56f9898c653e0197e704f5072d497a85
|
|
| MD5 |
316db2746764ed4882eac32a6e4b06d0
|
|
| BLAKE2b-256 |
b06a8c1b964c0319143f5b5bc195d3e91ed831b5c1224df259a4a7a44f914a3a
|