Mixin Classes ============= SQLAlchemy supports mixin classes for models to add functionality. OpenAlchemy supports this through the :samp:`x-mixins` extension property that may define one or more importable class to mix into the model class. .. seealso:: :ref:`mixins` OpenAlchemy documentation for the :samp:`x-mixins` value. The following example adds the :samp:`sqlalchemy_mixins.TimestampsMixin` to the :samp:`Employee` model: .. literalinclude:: ../../../examples/mixins/example-spec.yml :language: yaml :linenos: The following file uses OpenAlchemy to generate the SQLAlchemy models: .. literalinclude:: ../../../examples/mixins/models.py :language: python :linenos: The SQLAlchemy models generated by OpenAlchemy are equivalent to the following traditional models file: .. literalinclude:: ../../../examples/mixins/models_traditional.py :language: python :linenos: OpenAlchemy will generate the following typed models: .. literalinclude:: ../../../examples/mixins/models_auto.py :language: python :linenos: .. seealso:: :ref:`getting-started`