Collection of SQLAlchemy mixins
Project description
Bixomix
bixomix is a collection of SQLAlchemy mixins.
Support
- Python 3.9+
- SQLAlchemy 2.0+
Install
pip install bixomix
Usage
Add mixins after the Base class in each model’s parent classes. The order of the mixins doesn’t matter.
from sqlalchemy.orm import DeclarativeBase
from bixomix import CreatedAtMixin, EnabledMixin
class Base(DeclarativeBase):
pass
class MyModel(Base, CreatedAtMixin, EnabledMixin):
# Add your own fields here
...
Mixins
CreatedAtMixin: add acreated_atdatetime field that’s automatically filled with the record’s creation dateUpdatedAtMixin: add anupdated_atdatetime field that’s automatically filled with the record’s last update date. Note that on Postgres this is done in Python; for a database-level update you have to create a trigger.CreatedUpdatedAtMixin: combined version of the previous two mixinsEnabledMixin: add anenabledboolean field (default istrue)EnabledNoMixin: same asEnabledMixin, but the default value isfalseUpdateFromDictMixin: add anupdate_from_dictmethod to update a model in-place given a dictionary of attributes
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
bixomix-0.1.3.tar.gz
(3.2 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 bixomix-0.1.3.tar.gz.
File metadata
- Download URL: bixomix-0.1.3.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.16 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
682fcd46e00ebd617890a0866405288e817fc502076fc009583de889e12cb22b
|
|
| MD5 |
8997763a24d17efe14af9852ac954edb
|
|
| BLAKE2b-256 |
acd9a6a8f69b747a913225306e21d1bed2df1822416ab7fb2b446ad5dd4e7040
|
File details
Details for the file bixomix-0.1.3-py3-none-any.whl.
File metadata
- Download URL: bixomix-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.16 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e019e80c4a9c57eaffed28ae847d870fce5ee0df944fcaabd96a29eafe5b3532
|
|
| MD5 |
e238a3d051eb6e053d8c9a8d04d04937
|
|
| BLAKE2b-256 |
0dfe73dac52cfc9b8df50c512db64bd7da2a3cd68645c329216b9c3c6fcd175a
|