# unboil-sqlalchemy-mixins
Reusable SQLAlchemy mixins to reduce boilerplate in your Python ORM models.
## Installation
```bash
pip install unboil-sqlalchemy-mixins
```
## Mixins
### IdentifiableMixin
Adds a string `id` primary key. Optionally, use a prefix:
```python
from unboil_sqlalchemy_mixins import IdentifiableMixin
class User(IdentifiableMixin, Base): ...
# With prefix:
class PrefixedUser(IdentifiableMixin.with_id_prefix("user_"), Base): ...
```
### TimestampedMixin
Adds `created_at` and `updated_at` fields (auto-managed):
```python
from unboil_sqlalchemy_mixins import TimestampedMixin
class Post(TimestampedMixin, Base): ...
```
### TenantOwnedMixin
Adds a required, indexed `tenant_id` column. Optionally, specify a foreign key:
```python
from unboil_sqlalchemy_mixins import TenantOwnedMixin
class Invoice(TenantOwnedMixin, Base): ...
# With foreign key:
class InvoiceWithFK(TenantOwnedMixin.with_tenant_fk("tenants.id"), Base): ...
```
### UserOwnedMixin
Adds a required, indexed `user_id` column. Optionally, specify a foreign key:
```python
from unboil_sqlalchemy_mixins import UserOwnedMixin
class Note(UserOwnedMixin, Base): ...
# With foreign key:
class NoteWithFK(UserOwnedMixin.with_user_fk("users.id"), Base): ...
```
---
MIT License
Raw data
{
"_id": null,
"home_page": null,
"name": "unboil-sqlalchemy-mixins",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "mixins, sqlalchemy, unboil",
"author": "eyueldk",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/cd/11/2b46ad1f7555d54d7507ac0ed48ad0b18b5bc4c2e7b2b482d3c9ea031c5e/unboil_sqlalchemy_mixins-0.1.14.tar.gz",
"platform": null,
"description": "\n# unboil-sqlalchemy-mixins\n\nReusable SQLAlchemy mixins to reduce boilerplate in your Python ORM models.\n\n## Installation\n\n```bash\npip install unboil-sqlalchemy-mixins\n```\n\n## Mixins\n\n\n\n### IdentifiableMixin\nAdds a string `id` primary key. Optionally, use a prefix:\n```python\nfrom unboil_sqlalchemy_mixins import IdentifiableMixin\n\nclass User(IdentifiableMixin, Base): ...\n# With prefix:\nclass PrefixedUser(IdentifiableMixin.with_id_prefix(\"user_\"), Base): ...\n```\n\n### TimestampedMixin\nAdds `created_at` and `updated_at` fields (auto-managed):\n```python\nfrom unboil_sqlalchemy_mixins import TimestampedMixin\nclass Post(TimestampedMixin, Base): ...\n```\n\n\n\n### TenantOwnedMixin\nAdds a required, indexed `tenant_id` column. Optionally, specify a foreign key:\n```python\nfrom unboil_sqlalchemy_mixins import TenantOwnedMixin\n\nclass Invoice(TenantOwnedMixin, Base): ...\n# With foreign key:\nclass InvoiceWithFK(TenantOwnedMixin.with_tenant_fk(\"tenants.id\"), Base): ...\n```\n\n\n\n### UserOwnedMixin\nAdds a required, indexed `user_id` column. Optionally, specify a foreign key:\n```python\nfrom unboil_sqlalchemy_mixins import UserOwnedMixin\n\nclass Note(UserOwnedMixin, Base): ...\n# With foreign key:\nclass NoteWithFK(UserOwnedMixin.with_user_fk(\"users.id\"), Base): ...\n```\n\n---\nMIT License",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library providing reusable mixins for SQLAlchemy models.",
"version": "0.1.14",
"project_urls": {
"homepage": "https://github.com/eyueldk/unboil-sqlalchemy-mixins",
"repository": "https://github.com/eyueldk/unboil-sqlalchemy-mixins"
},
"split_keywords": [
"mixins",
" sqlalchemy",
" unboil"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2da5a0de7836248b0ea3e431900bbdb9e62ea763a0ef9c858a1622a5f7d8a538",
"md5": "501a24bd0422d96d56c312746613bee9",
"sha256": "9a3aa4390a073696dce593923b3e0e26fe7256143a4253b43adda7b551472e59"
},
"downloads": -1,
"filename": "unboil_sqlalchemy_mixins-0.1.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "501a24bd0422d96d56c312746613bee9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5154,
"upload_time": "2025-08-16T05:08:07",
"upload_time_iso_8601": "2025-08-16T05:08:07.092728Z",
"url": "https://files.pythonhosted.org/packages/2d/a5/a0de7836248b0ea3e431900bbdb9e62ea763a0ef9c858a1622a5f7d8a538/unboil_sqlalchemy_mixins-0.1.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cd112b46ad1f7555d54d7507ac0ed48ad0b18b5bc4c2e7b2b482d3c9ea031c5e",
"md5": "beaa24aab9f45643740feb7707058a02",
"sha256": "d3084f13833f83be3306e211c229bbbff89c8e94bd3b0d44379ad8b5a490605f"
},
"downloads": -1,
"filename": "unboil_sqlalchemy_mixins-0.1.14.tar.gz",
"has_sig": false,
"md5_digest": "beaa24aab9f45643740feb7707058a02",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 29060,
"upload_time": "2025-08-16T05:08:08",
"upload_time_iso_8601": "2025-08-16T05:08:08.155783Z",
"url": "https://files.pythonhosted.org/packages/cd/11/2b46ad1f7555d54d7507ac0ed48ad0b18b5bc4c2e7b2b482d3c9ea031c5e/unboil_sqlalchemy_mixins-0.1.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-16 05:08:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eyueldk",
"github_project": "unboil-sqlalchemy-mixins",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "unboil-sqlalchemy-mixins"
}