You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/24 09:21:27 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #20397: Simplest event note POC

uranusjr commented on a change in pull request #20397:
URL: https://github.com/apache/airflow/pull/20397#discussion_r774944353



##########
File path: airflow/models/event_note.py
##########
@@ -0,0 +1,48 @@
+import logging
+from sqlalchemy import Column, Integer, String, Text
+from airflow.models.base import COLLATION_ARGS, ID_LEN, Base
+from airflow.utils import timezone
+from airflow.utils.sqlalchemy import UtcDateTime
+
+log = logging.getLogger(__name__)
+
+
+class EventNote(Base):
+    """Model that stores a note for an event"""
+
+    __tablename__ = "event_note"
+
+    id = Column(Integer, primary_key=True)
+
+    dag_id = Column(String(ID_LEN, **COLLATION_ARGS))
+    task_id = Column(String(ID_LEN), nullable=True)
+    execution_date = Column(UtcDateTime, nullable=True)
+    timestamp = Column(UtcDateTime, nullable=True)
+    event = Column(String(30), nullable=True)
+    owner = Column(String(30), nullable=True)

Review comment:
       I feel these should be made required and non-nullable.

##########
File path: airflow/models/event_note.py
##########
@@ -0,0 +1,48 @@
+import logging
+from sqlalchemy import Column, Integer, String, Text
+from airflow.models.base import COLLATION_ARGS, ID_LEN, Base
+from airflow.utils import timezone
+from airflow.utils.sqlalchemy import UtcDateTime
+
+log = logging.getLogger(__name__)
+
+
+class EventNote(Base):
+    """Model that stores a note for an event"""
+
+    __tablename__ = "event_note"
+
+    id = Column(Integer, primary_key=True)
+
+    dag_id = Column(String(ID_LEN, **COLLATION_ARGS))
+    task_id = Column(String(ID_LEN), nullable=True)
+    execution_date = Column(UtcDateTime, nullable=True)

Review comment:
       Better to point to run_id. But I actually feel this is restricting the usage too narrowly; a better way might be to have a field called `type` or something, and an identifier field to store a JSON blob, and store an identifier that makes sense for each event type (e.g. the  primary of a DAG run, a task isntance, or something else).




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org