ferruzzi commented on code in PR #58248: URL: https://github.com/apache/airflow/pull/58248#discussion_r2522673602
########## airflow-core/src/airflow/models/deadline_alert.py: ########## @@ -0,0 +1,101 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +from datetime import datetime +from typing import TYPE_CHECKING + +import uuid6 +from sqlalchemy import JSON, Float, ForeignKey, String, Text, select +from sqlalchemy.orm import Mapped +from sqlalchemy_utils import UUIDType + +from airflow._shared.timezones import timezone +from airflow.models import Base +from airflow.models.deadline import ReferenceModels +from airflow.utils.session import NEW_SESSION, provide_session +from airflow.utils.sqlalchemy import UtcDateTime, mapped_column + +if TYPE_CHECKING: + from sqlalchemy.orm import Session + + +class DeadlineAlert(Base): + """Table containing DeadlineAlert properties.""" + + __tablename__ = "deadline_alert" + + id: Mapped[str] = mapped_column(UUIDType(binary=False), primary_key=True, default=uuid6.uuid7) + created_at: Mapped[datetime] = mapped_column(UtcDateTime, nullable=False, default=timezone.utcnow) + + serialized_dag_id: Mapped[str] = mapped_column( Review Comment: Using serialized_dag_id should keep it synced with the proper dag version, but also since I am pulling the data out of the serialized_dag into the new table and replacing the old data with the UUIDs of the new rows, so it seemed the most logical -- 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]
