Universal, framework-independent ORM for Python.
Project description
MosaicDB
Universal, framework-independent ORM for Python.
Getting Started
from pydantic import BaseModel
from mosaicdb import Mosaic
from mosaicdb.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
mosaicdb makemigrations users --db sqlite:///test.db --schema '{"id": "int", "name": "str"}'
mosaicdb migrate users --db sqlite:///test.db
mosaicdb create-table users --db sqlite:///test.db --schema '{"id": "int", "name": "str"}'
mosaicdb drop-table users --db sqlite:///test.db
mosaicdb inspect-schema users --db sqlite:///test.db
mosaicdb seed users --db sqlite:///test.db --data '{"id": 1, "name": "Alice"}'
mosaicdb 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 mosaicdb
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.1.tar.gz
(10.7 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.1.tar.gz.
File metadata
- Download URL: mosaicdb-0.1.1.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7f8bdedf9fabb8baac7af25c6238ea33812b417e5373792a128e1434af135c2
|
|
| MD5 |
461342c5d9102061a2bfab542ba1e94b
|
|
| BLAKE2b-256 |
e42ec09600c05351097a7e45c60f29b7a7968231baa6077f042e58f802530b7d
|
File details
Details for the file mosaicdb-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mosaicdb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.8 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 |
825d920cc2399a00dfc85e722934875ea1645d5f49728a9c43bf5af4a9dfff08
|
|
| MD5 |
1c748b4af807f11dca400089cbce246a
|
|
| BLAKE2b-256 |
66202a83b4337b717ec5f90fe04ea666d1cc0c780434d8da92e84b1ca84619b5
|