feluelle commented on a change in pull request #5530: [AIRFLOW-1740] Fix xcom creation and update via UI URL: https://github.com/apache/airflow/pull/5530#discussion_r302027682
########## File path: airflow/www/views.py ########## @@ -2685,6 +2685,9 @@ class XComView(wwwutils.SuperUserMixin, AirflowModelView): filter_converter = wwwutils.UtcFilterConverter() form_overrides = dict(execution_date=DateTimeField) + def on_model_change(self, form, model, is_created): + XCom.set(**form.data) Review comment: > But this will end up storing two records - one that we create here, and another from https://github.com/flask-admin/flask-admin/blob/8341a9ceae6e9206cb6b91a3b896ed02faaafccc/flask_admin/contrib/sqla/view.py#L1129-L1132 No, there will actually only be one entry in the table because of `# remove any duplicate XComs` section in `XCom.set`. > The "correct" fix is probably to make the `value` accessors on XCom transparently handle the (de)serialization. I don't know how this can be done. So for now I just copied the block for the string to byte conversion to the `on_model_change`. It might not be the best solution but this at least does not * creates a session * removes any duplicate XComs * insert new XCom (what `XCom.set(**form.data)` did) @ashb PTAL ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services