Lee-W commented on code in PR #55952: URL: https://github.com/apache/airflow/pull/55952#discussion_r2405105354
########## airflow-core/src/airflow/models/hitl_history.py: ########## @@ -0,0 +1,90 @@ +# 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 typing import TYPE_CHECKING + +import sqlalchemy_jsonfield +from sqlalchemy import Boolean, Column, ForeignKeyConstraint, String, Text +from sqlalchemy.dialects import postgresql +from sqlalchemy.orm import relationship + +from airflow._shared.timezones import timezone +from airflow.models.base import Base +from airflow.settings import json +from airflow.utils.sqlalchemy import UtcDateTime + +if TYPE_CHECKING: + from airflow.models.hitl import HITLDetail + + +class HITLDetailHistory(Base): + """ + Store HITLDetail for old tries of TaskInstances. + + :meta private: + """ + + __tablename__ = "hitl_detail_history" + ti_history_id = 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) Review Comment: It's possible, but I’d like to ensure that this design aligns with the history counterpart from TI. This approach will also give us more flexibility if we need to make changes to `HITLDetail` without affecting the history section. It can create more challenges if we accidentally add elements to both sides than if we happen to miss something. -- 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]
