Universal, framework-independent ORM for Python.
Project description
Mosaic ORM
Universal, framework-independent ORM for Python.
Getting Started
from pydantic import BaseModel
from mosaic import Mosaic
from mosaic.models import ModelMixin
class User(BaseModel, ModelMixin):
id: int
name: str
age: int
db = Mosaic("sqlite:///test.db")
User.create_table(db)
User.insert(db, User(id=1, name="Alice", age=30))
users = User.find(db)
print(users)
Features Table
| Feature | Supported |
|---|---|
| Simple Syntax | ✅ |
| Multi-DB Support | ✅ |
| Multi-Table/FK | ✅ |
| Auto Migrations | ✅ |
| CLI | ✅ |
| Typesafe Models | ✅ |
| NoSQL (MongoDB) | ✅ |
| Error Handling | ✅ |
| Test Coverage | ✅ |
Database Support Matrix
| Database | CRUD | FKs | Migrations | CLI | Typesafe Models |
|---|---|---|---|---|---|
| SQLite | ✅ | ✅ | ✅ | ✅ | ✅ |
| MySQL | ✅ | ✅ | ✅ | ✅ | ✅ |
| PostgreSQL | ✅ | ✅ | ✅ | ✅ | ✅ |
| MongoDB | ✅ | ❌ | Schemaless | ✅ | ✅ |
CLI Command Examples
python mosaic/cli.py makemigrations users --db sqlite:///test.db --schema '{"id": "int", "name": "str"}'
python mosaic/cli.py migrate users --db sqlite:///test.db
python mosaic/cli.py create-table users --db sqlite:///test.db --schema '{"id": "int", "name": "str"}'
python mosaic/cli.py drop-table users --db sqlite:///test.db
python mosaic/cli.py inspect-schema users --db sqlite:///test.db
python mosaic/cli.py seed users --db sqlite:///test.db --data '{"id": 1, "name": "Alice"}'
python mosaic/cli.py raw-sql --db sqlite:///test.db --sql "SELECT * FROM users"
Versioning & Changelog
- Current version: v0.1.0-alpha
- See
CHANGELOG.mdfor updates.
PyPI Installation
pip install mosaic-orm
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
mosaicdb-0.1.0a0.tar.gz
(9.9 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 mosaicdb-0.1.0a0.tar.gz.
File metadata
- Download URL: mosaicdb-0.1.0a0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7aebea3f844f1ff224fd9197ce82c32b81cf0d6d05fce0611682f1b6c736c281
|
|
| MD5 |
fd69961e5834888dfcc458a592122c35
|
|
| BLAKE2b-256 |
cb5878be48a34829f59d722e5981b5bf008fc246c223de3965a76ec0b27c49a7
|
File details
Details for the file mosaicdb-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: mosaicdb-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2aaca0fed5a3cbbe7b79e0a5e96a13434f846c84c163fab59607a7a45d306c6d
|
|
| MD5 |
f166f04f2cc9ff6392a85e989df2d0bc
|
|
| BLAKE2b-256 |
ee2f1424cafa2d0d461d185ccb1df14c9bc644606ff90016f1c115736e7fc25a
|