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/07/07 10:23:50 UTC

[GitHub] [airflow] ashb commented on pull request #16786: Use Serialization to support more objects in XCom

ashb commented on pull request #16786:
URL: https://github.com/apache/airflow/pull/16786#issuecomment-875485644


   Yeah, this _toally_ breaks all existing JSON XComs:
   
   ```
   In [1]: from airflow.serialization.serialized_objects import BaseSerialization
   
   In [2]: BaseSerialization.from_dict({"x": "y"})
   ---------------------------------------------------------------------------
   KeyError                                  Traceback (most recent call last)
   <ipython-input-2-5a1376cdcc27> in <module>
   ----> 1 BaseSerialization.from_dict({"x": "y"})
   
   ~/code/airflow/airflow/airflow/serialization/serialized_objects.py in from_dict(cls, serialized_obj)
       136         reconstructs all DAGs and operators it contains.
       137         """
   --> 138         return cls._deserialize(serialized_obj)
       139 
       140     @classmethod
   
   ~/code/airflow/airflow/airflow/serialization/serialized_objects.py in _deserialize(cls, encoded_var)
       269         if not isinstance(encoded_var, dict):
       270             raise ValueError(f"The encoded_var should be dict and is {type(encoded_var)}")
   --> 271         var = encoded_var[Encoding.VAR]
       272         type_ = encoded_var[Encoding.TYPE]
       273 
   
   KeyError: <Encoding.VAR: '__var'>
   
   In [3]: BaseSerialization.from_dict({"x": "y"})
   ```


-- 
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