"""
    Triggers are a workload that run in an asynchronous event loop shared with
    other Triggers, and fire off events that will unpause deferred Tasks,
    start linked DAGs, etc.
    They are persisted into the database and then re-hydrated into a
    "triggerer" process, where many are run at once. We model it so that
    there is a many-to-one relationship between Task and Trigger, for future
    deduplication logic to use.
    Rows will be evicted from the database when the triggerer detects no
    active Tasks/DAGs using them. Events are not stored in the database;
    when an Event is fired, the triggerer will directly push its data to the
    appropriate Task/DAG.
    """
    __tablename__ = "trigger"
    id = Column(Integer, primary_key=True)
    classpath = Column(String(1000), nullable=False)
    kwargs = Column(ExtendedJSON, nullable=False)
    created_date = Column(UtcDateTime, nullable=False)
    triggerer_id = Column(Integer, nullable=True)
    triggerer_job = relationship(
        "BaseJob",
        primaryjoin="BaseJob.id == Trigger.triggerer_id",
        foreign_keys=triggerer_id,
        uselist=False,
    )
    task_instance = relationship("TaskInstance", back_populates="trigger", lazy="joined", uselist=False)
    def __init__(self, classpath: str, kwargs: dict[str, Any], created_date: datetime.datetime | None = None):