code: def check_run_id_null(session: Session) -> Iterable[str]:
      from airflow.models.dagrun import DagRun
  
      metadata = reflect_tables([DagRun], session)
  
      # We can't use the model here since it may differ from the db state due to
      # this function is run prior to migration. Use the reflected table instead.
      dagrun_table = metadata.tables.get(DagRun.__tablename__)
      if dagrun_table is None:
          return
  
      invalid_dagrun_filter = or_(
          dagrun_table.c.dag_id.is_(None),
          dagrun_table.c.run_id.is_(None),
          dagrun_table.c.execution_date.is_(None),
      )
      invalid_dagrun_count = session.scalar(
          select(func.count(dagrun_table.c.id)).where(
              invalid_dagrun_filter
          )
      )
      if invalid_dagrun_count > 0:
          dagrun_dangling_table_name = _format_airflow_moved_table_name(
              dagrun_table.name, "2.2", "dangling"
          )
          if (
              dagrun_dangling_table_name
              in inspect(session.get_bind()).get_table_names()
          ):
              yield _format_dangling_error(
                  source_table=dagrun_table.name,
                  target_table=dagrun_dangling_table_name,
                  invalid_count=invalid_dagrun_count,
                  reason="with a NULL dag_id, run_id, or execution_date",
              )
              return
  
          bind = session.get_bind()
          dialect_name = bind.dialect.name
          _create_table_as(
              dialect_name=dialect_name,
              source_query=dagrun_table.select(invalid_dagrun_filter),
              target_table_name=dagrun_dangling_table_name,
              source_table_name=dagrun_table.name,
              session=session,
          )
          delete = dagrun_table.delete().where(invalid_dagrun_filter)
          session.execute(delete)
  
imports: from __future__ import annotations
  import contextlib
  import enum
  import json
  import logging
  import os
  import sys
  import time
  import warnings
  from dataclasses import dataclass
  from tempfile import gettempdir
  from typing import TYPE_CHECKING, Callable, Generator, Iterable
  from sqlalchemy import Table, and_, column, delete, exc, func, inspect, literal, or_, select, table, text, tuple_
  import airflow
  from airflow import settings
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException
  from airflow.models import import_all_models
  from airflow.utils import helpers
  from airflow.utils.session import NEW_SESSION, create_session, provide_session
label_desc: Use image node_id 22 for calling a global function with example usage: check_run_id_null(session) without return types