Model mixins

Timestamp

class sqlalchemy_utils.models.Timestamp[source]

Adds created and updated columns to a derived declarative model.

The created column is handled through a default and the updated column is handled through a before_update event that propagates for all derived declarative models.

import sqlalchemy as sa
from sqlalchemy_utils import Timestamp


class SomeModel(Base, Timestamp):
    __tablename__ = 'somemodel'
    id = sa.Column(sa.Integer, primary_key=True)