Skip to main content

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 a created_at datetime field that’s automatically filled with the record’s creation date
  • UpdatedAtMixin: add an updated_at datetime 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 mixins
  • EnabledMixin: add an enabled boolean field (default is true)
  • EnabledNoMixin: same as EnabledMixin, but the default value is false
  • UpdateFromDictMixin: add an update_from_dict method 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bixomix-0.1.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

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

Hashes for bixomix-0.1.3.tar.gz
Algorithm Hash digest
SHA256 682fcd46e00ebd617890a0866405288e817fc502076fc009583de889e12cb22b
MD5 8997763a24d17efe14af9852ac954edb
BLAKE2b-256 acd9a6a8f69b747a913225306e21d1bed2df1822416ab7fb2b446ad5dd4e7040

See more details on using hashes here.

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

Hashes for bixomix-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e019e80c4a9c57eaffed28ae847d870fce5ee0df944fcaabd96a29eafe5b3532
MD5 e238a3d051eb6e053d8c9a8d04d04937
BLAKE2b-256 0dfe73dac52cfc9b8df50c512db64bd7da2a3cd68645c329216b9c3c6fcd175a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page