@@ -149,29 +149,31 @@ class DagRun(Base, LoggingMixin):
149149
150150 id : Mapped [int ] = mapped_column (Integer , primary_key = True )
151151 dag_id : Mapped [str ] = mapped_column (StringID (), nullable = False )
152- queued_at : Mapped [UtcDateTime ] = mapped_column (UtcDateTime )
152+ queued_at : Mapped [UtcDateTime | None ] = mapped_column (UtcDateTime , nullable = True )
153153 logical_date : Mapped [UtcDateTime | None ] = mapped_column (UtcDateTime , nullable = True )
154- start_date : Mapped [UtcDateTime ] = mapped_column (UtcDateTime )
155- end_date : Mapped [UtcDateTime ] = mapped_column (UtcDateTime )
154+ start_date : Mapped [UtcDateTime | None ] = mapped_column (UtcDateTime , nullable = True )
155+ end_date : Mapped [UtcDateTime | None ] = mapped_column (UtcDateTime , nullable = True )
156156 _state : Mapped [str ] = mapped_column ("state" , String (50 ), default = DagRunState .QUEUED )
157157 run_id : Mapped [str ] = mapped_column (StringID (), nullable = False )
158- creating_job_id : Mapped [int ] = mapped_column (Integer )
158+ creating_job_id : Mapped [int | None ] = mapped_column (Integer , nullable = True )
159159 run_type : Mapped [str ] = mapped_column (String (50 ), nullable = False )
160- triggered_by : Mapped [DagRunTriggeredByType ] = mapped_column (
161- Enum (DagRunTriggeredByType , native_enum = False , length = 50 )
160+ triggered_by : Mapped [DagRunTriggeredByType | None ] = mapped_column (
161+ Enum (DagRunTriggeredByType , native_enum = False , length = 50 ), nullable = True
162162 ) # Airflow component that triggered the run.
163163 triggering_user_name : Mapped [str | None ] = mapped_column (
164164 String (512 ),
165165 nullable = True ,
166166 ) # The user that triggered the DagRun, if applicable
167- conf : Mapped [dict [str , Any ]] = mapped_column (JSON ().with_variant (postgresql .JSONB , "postgresql" ))
167+ conf : Mapped [dict [str , Any ] | None ] = mapped_column (
168+ JSON ().with_variant (postgresql .JSONB , "postgresql" ), nullable = True
169+ )
168170 # These two must be either both NULL or both datetime.
169- data_interval_start : Mapped [UtcDateTime ] = mapped_column (UtcDateTime )
170- data_interval_end : Mapped [UtcDateTime ] = mapped_column (UtcDateTime )
171+ data_interval_start : Mapped [UtcDateTime | None ] = mapped_column (UtcDateTime , nullable = True )
172+ data_interval_end : Mapped [UtcDateTime | None ] = mapped_column (UtcDateTime , nullable = True )
171173 # Earliest time when this DagRun can start running.
172174 run_after : Mapped [UtcDateTime ] = mapped_column (UtcDateTime , default = _default_run_after , nullable = False )
173175 # When a scheduler last attempted to schedule TIs for this DagRun
174- last_scheduling_decision : Mapped [UtcDateTime ] = mapped_column (UtcDateTime )
176+ last_scheduling_decision : Mapped [UtcDateTime | None ] = mapped_column (UtcDateTime , nullable = True )
175177 # Foreign key to LogTemplate. DagRun rows created prior to this column's
176178 # existence have this set to NULL. Later rows automatically populate this on
177179 # insert to point to the latest LogTemplate entry.
@@ -193,11 +195,13 @@ class DagRun(Base, LoggingMixin):
193195
194196 It's possible this could change if e.g. the dag run is cleared to be rerun, or perhaps re-backfilled.
195197 """
196- bundle_version : Mapped [str ] = mapped_column (StringID ())
198+ bundle_version : Mapped [str | None ] = mapped_column (StringID (), nullable = True )
197199
198- scheduled_by_job_id : Mapped [int ] = mapped_column (Integer )
200+ scheduled_by_job_id : Mapped [int | None ] = mapped_column (Integer , nullable = True )
199201 # Span context carrier, used for context propagation.
200- context_carrier : Mapped [dict [str , Any ]] = mapped_column (MutableDict .as_mutable (ExtendedJSON ))
202+ context_carrier : Mapped [dict [str , Any ] | None ] = mapped_column (
203+ MutableDict .as_mutable (ExtendedJSON ), nullable = True
204+ )
201205 span_status : Mapped [str ] = mapped_column (
202206 String (250 ), server_default = SpanStatus .NOT_STARTED , nullable = False
203207 )
0 commit comments