Dev-iL commented on code in PR #55954:
URL: https://github.com/apache/airflow/pull/55954#discussion_r2382970507


##########
airflow-core/src/airflow/models/dagbag.py:
##########
@@ -115,14 +116,14 @@ class DagPriorityParsingRequest(Base):
     # Adding a unique constraint to fileloc results in the creation of an 
index and we have a limitation
     # on the size of the string we can use in the index for MySQL DB. We also 
have to keep the fileloc
     # size consistent with other tables. This is a workaround to enforce the 
unique constraint.
-    id = Column(String(32), primary_key=True, default=generate_md5_hash, 
onupdate=generate_md5_hash)
+    id = mapped_column(String(32), primary_key=True, 
default=generate_md5_hash, onupdate=generate_md5_hash)
 
-    bundle_name = Column(StringID(), nullable=False)
+    bundle_name = mapped_column(StringID(), nullable=False)
     # The location of the file containing the DAG object
     # Note: Do not depend on fileloc pointing to a file; in the case of a
     # packaged DAG, it will point to the subpath of the DAG within the
     # associated zip.
-    relative_fileloc = Column(String(2000), nullable=False)
+    relative_fileloc = mapped_column(String(2000), nullable=False)

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/dagwarning.py:
##########
@@ -43,10 +43,10 @@ class DagWarning(Base):
     when parsing DAG and displayed on the Webserver in a flash message.
     """
 
-    dag_id = Column(StringID(), primary_key=True)
-    warning_type = Column(String(50), primary_key=True)
-    message = Column(Text, nullable=False)
-    timestamp = Column(UtcDateTime, nullable=False, default=timezone.utcnow)
+    dag_id = mapped_column(StringID(), primary_key=True)
+    warning_type = mapped_column(String(50), primary_key=True)
+    message = mapped_column(Text, nullable=False)
+    timestamp = mapped_column(UtcDateTime, nullable=False, 
default=timezone.utcnow)

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/dagcode.py:
##########
@@ -54,15 +54,17 @@ class DagCode(Base):
     """
 
     __tablename__ = "dag_code"
-    id = Column(UUIDType(binary=False), primary_key=True, default=uuid6.uuid7)
-    dag_id = Column(String(ID_LEN), nullable=False)
-    fileloc = Column(String(2000), nullable=False)
+    id = mapped_column(UUIDType(binary=False), primary_key=True, 
default=uuid6.uuid7)
+    dag_id = mapped_column(String(ID_LEN), nullable=False)
+    fileloc = mapped_column(String(2000), nullable=False)
     # The max length of fileloc exceeds the limit of indexing.
-    created_at = Column(UtcDateTime, nullable=False, default=timezone.utcnow)
-    last_updated = Column(UtcDateTime, nullable=False, 
default=timezone.utcnow, onupdate=timezone.utcnow)
-    source_code = Column(Text().with_variant(MEDIUMTEXT(), "mysql"), 
nullable=False)
-    source_code_hash = Column(String(32), nullable=False)
-    dag_version_id = Column(
+    created_at = mapped_column(UtcDateTime, nullable=False, 
default=timezone.utcnow)
+    last_updated = mapped_column(
+        UtcDateTime, nullable=False, default=timezone.utcnow, 
onupdate=timezone.utcnow
+    )
+    source_code = mapped_column(Text().with_variant(MEDIUMTEXT(), "mysql"), 
nullable=False)
+    source_code_hash = mapped_column(String(32), nullable=False)
+    dag_version_id = mapped_column(

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/hitl.py:
##########
@@ -84,31 +84,31 @@ class HITLDetail(Base):
     """Human-in-the-loop request and corresponding response."""
 
     __tablename__ = "hitl_detail"
-    ti_id = Column(
+    ti_id = mapped_column(
         String(36).with_variant(postgresql.UUID(as_uuid=False), "postgresql"),
         primary_key=True,
         nullable=False,
     )
 
     # User Request Detail
-    options = Column(sqlalchemy_jsonfield.JSONField(json=json), nullable=False)
-    subject = Column(Text, nullable=False)
-    body = Column(Text, nullable=True)
-    defaults = Column(sqlalchemy_jsonfield.JSONField(json=json), nullable=True)
-    multiple = Column(Boolean, unique=False, default=False)
-    params = Column(sqlalchemy_jsonfield.JSONField(json=json), nullable=False, 
default={})
-    assignees = Column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=True)
-    created_at = Column(UtcDateTime, default=timezone.utcnow, nullable=False)
+    options = mapped_column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=False)
+    subject = mapped_column(Text, nullable=False)
+    body = mapped_column(Text, nullable=True)
+    defaults = mapped_column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=True)
+    multiple = mapped_column(Boolean, unique=False, default=False)
+    params = mapped_column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=False, default={})
+    assignees = mapped_column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=True)
+    created_at = mapped_column(UtcDateTime, default=timezone.utcnow, 
nullable=False)
 
     # Response Content Detail
-    responded_at = Column(UtcDateTime, nullable=True)
-    responded_by = Column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=True)
-    chosen_options = Column(
+    responded_at = mapped_column(UtcDateTime, nullable=True)
+    responded_by = mapped_column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=True)
+    chosen_options = mapped_column(
         sqlalchemy_jsonfield.JSONField(json=json),
         nullable=True,
         default=None,
     )
-    params_input = Column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=False, default={})
+    params_input = mapped_column(sqlalchemy_jsonfield.JSONField(json=json), 
nullable=False, default={})

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/db_callback_request.py:
##########
@@ -35,11 +35,11 @@ class DbCallbackRequest(Base):
 
     __tablename__ = "callback_request"
 
-    id = Column(Integer(), nullable=False, primary_key=True)
-    created_at = Column(UtcDateTime, default=timezone.utcnow, nullable=False)
-    priority_weight = Column(Integer(), nullable=False)
-    callback_data = Column(ExtendedJSON, nullable=False)
-    callback_type = Column(String(20), nullable=False)
+    id = mapped_column(Integer(), nullable=False, primary_key=True)
+    created_at = mapped_column(UtcDateTime, default=timezone.utcnow, 
nullable=False)
+    priority_weight = mapped_column(Integer(), nullable=False)
+    callback_data = mapped_column(ExtendedJSON, nullable=False)
+    callback_type = mapped_column(String(20), nullable=False)

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/dag_version.py:
##########
@@ -62,8 +62,10 @@ class DagVersion(Base):
         cascade_backrefs=False,
     )
     task_instances = relationship("TaskInstance", back_populates="dag_version")
-    created_at = Column(UtcDateTime, nullable=False, default=timezone.utcnow)
-    last_updated = Column(UtcDateTime, nullable=False, 
default=timezone.utcnow, onupdate=timezone.utcnow)
+    created_at = mapped_column(UtcDateTime, nullable=False, 
default=timezone.utcnow)
+    last_updated = mapped_column(
+        UtcDateTime, nullable=False, default=timezone.utcnow, 
onupdate=timezone.utcnow
+    )

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/serialized_dag.py:
##########
@@ -304,7 +306,7 @@ class SerializedDagModel(Base):
         innerjoin=True,
         backref=backref("serialized_dag", uselist=False, innerjoin=True),
     )
-    dag_version_id = Column(
+    dag_version_id = mapped_column(

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/dagbundle.py:
##########
@@ -42,12 +42,12 @@ class DagBundleModel(Base, LoggingMixin):
     """
 
     __tablename__ = "dag_bundle"
-    name = Column(StringID(length=250), primary_key=True, nullable=False)
-    active = Column(Boolean, default=True)
-    version = Column(String(200), nullable=True)
-    last_refreshed = Column(UtcDateTime, nullable=True)
-    signed_url_template = Column(String(200), nullable=True)
-    template_params = Column(JSONType, nullable=True)
+    name = mapped_column(StringID(length=250), primary_key=True, 
nullable=False)
+    active = mapped_column(Boolean, default=True)
+    version = mapped_column(String(200), nullable=True)
+    last_refreshed = mapped_column(UtcDateTime, nullable=True)
+    signed_url_template = mapped_column(String(200), nullable=True)
+    template_params = mapped_column(JSONType, nullable=True)

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/errors.py:
##########
@@ -17,22 +17,22 @@
 # under the License.
 from __future__ import annotations
 
-from sqlalchemy import Column, Integer, String, Text
+from sqlalchemy import Integer, String, Text
 
 from airflow.dag_processing.bundles.manager import DagBundlesManager
 from airflow.models.base import Base, StringID
-from airflow.utils.sqlalchemy import UtcDateTime
+from airflow.utils.sqlalchemy import UtcDateTime, mapped_column
 
 
 class ParseImportError(Base):
     """Stores all Import Errors which are recorded when parsing DAGs and 
displayed on the Webserver."""
 
     __tablename__ = "import_error"
-    id = Column(Integer, primary_key=True)
-    timestamp = Column(UtcDateTime)
-    filename = Column(String(1024))
-    bundle_name = Column(StringID())
-    stacktrace = Column(Text)
+    id = mapped_column(Integer, primary_key=True)
+    timestamp = mapped_column(UtcDateTime)
+    filename = mapped_column(String(1024))
+    bundle_name = mapped_column(StringID())
+    stacktrace = mapped_column(Text)

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/log.py:
##########
@@ -36,18 +36,18 @@ class Log(Base):
 
     __tablename__ = "log"
 
-    id = Column(Integer, primary_key=True)
-    dttm = Column(UtcDateTime)
-    dag_id = Column(StringID())
-    task_id = Column(StringID())
-    map_index = Column(Integer)
-    event = Column(String(60))
-    logical_date = Column(UtcDateTime)
-    run_id = Column(StringID())
-    owner = Column(String(500))
-    owner_display_name = Column(String(500))
-    extra = Column(Text)
-    try_number = Column(Integer)
+    id = mapped_column(Integer, primary_key=True)
+    dttm = mapped_column(UtcDateTime)
+    dag_id = mapped_column(StringID())
+    task_id = mapped_column(StringID())
+    map_index = mapped_column(Integer)
+    event = mapped_column(String(60))
+    logical_date = mapped_column(UtcDateTime)
+    run_id = mapped_column(StringID())
+    owner = mapped_column(String(500))
+    owner_display_name = mapped_column(String(500))
+    extra = mapped_column(Text)
+    try_number = mapped_column(Integer)

Review Comment:
   `Mapped[...]`



##########
airflow-core/src/airflow/models/deadline.py:
##########
@@ -97,22 +97,22 @@ class Deadline(Base):
 
     __tablename__ = "deadline"
 
-    id = Column(UUIDType(binary=False), primary_key=True, default=uuid6.uuid7)
+    id = mapped_column(UUIDType(binary=False), primary_key=True, 
default=uuid6.uuid7)
 
     # If the Deadline Alert is for a DAG, store the DAG run ID from the 
dag_run.
-    dagrun_id = Column(Integer, ForeignKey("dag_run.id", ondelete="CASCADE"))
+    dagrun_id = mapped_column(Integer, ForeignKey("dag_run.id", 
ondelete="CASCADE"))
 
     # The time after which the Deadline has passed and the callback should be 
triggered.
-    deadline_time = Column(UtcDateTime, nullable=False)
+    deadline_time = mapped_column(UtcDateTime, nullable=False)
     # The (serialized) callback to be called when the Deadline has passed.
-    _callback = Column("callback", sqlalchemy_jsonfield.JSONField(json=json), 
nullable=False)
+    _callback = mapped_column("callback", 
sqlalchemy_jsonfield.JSONField(json=json), nullable=False)
     # The state of the deadline callback
-    callback_state = Column(String(20))
+    callback_state = mapped_column(String(20))
 
     dagrun = relationship("DagRun", back_populates="deadlines")
 
     # The Trigger where the callback is running
-    trigger_id = Column(Integer, ForeignKey("trigger.id"), nullable=True)
+    trigger_id = mapped_column(Integer, ForeignKey("trigger.id"), 
nullable=True)

Review Comment:
   `Mapped[...]`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to