Fokko commented on a change in pull request #6370: AIRFLOW-5701: Don't clear 
xcom explicitly before execution
URL: https://github.com/apache/airflow/pull/6370#discussion_r339316587
 
 

 ##########
 File path: airflow/models/xcom.py
 ##########
 @@ -43,16 +43,14 @@ class XCom(Base, LoggingMixin):
     """
     __tablename__ = "xcom"
 
-    id = Column(Integer, primary_key=True)
-    key = Column(String(512))
+    key = Column(String(512), primary_key=True, nullable=False)
     value = Column(LargeBinary)
-    timestamp = Column(
-        UtcDateTime, default=timezone.utcnow, nullable=False)
-    execution_date = Column(UtcDateTime, nullable=False)
+    timestamp = Column(UtcDateTime, default=timezone.utcnow, nullable=False)
+    execution_date = Column(UtcDateTime, primary_key=True, nullable=False)
 
     # source information
-    task_id = Column(String(ID_LEN), nullable=False)
-    dag_id = Column(String(ID_LEN), nullable=False)
+    task_id = Column(String(ID_LEN), primary_key=True, nullable=False)
+    dag_id = Column(String(ID_LEN), primary_key=True, nullable=False)
 
     __table_args__ = (
         Index('idx_xcom_dag_task_date', dag_id, task_id, execution_date, 
unique=False),
 
 Review comment:
   The change is fully backward compatible. The only chance is getting rid of 
the `id` column because that one wasn't used anywhere in the code. The index on 
there has been replaced by the primary key. Because this is such a small 
change, I thought this would be okay to keep this only for new installations.
   
   The merging of the alembic should have been fixed here: 
https://github.com/apache/airflow/pull/6362 Please check if you're on the 
latest master. The unit test sounds like an excellent idea.
   
   Regarding the upgrade, that should work. Could you share the error?
   
   I'll work on a migration script: 
https://jira.apache.org/jira/browse/AIRFLOW-5767
   
   
    
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to