apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.75k stars 14.22k forks source link

UI - xcom - order by Execution Date #33100

Open raphaelauv opened 1 year ago

raphaelauv commented 1 year ago

Apache Airflow version

2.6.3

What happened

when you click on Execution Date on the ui http://XXXX:XXX/xcom/list/

the webserver fail

{app.py:1744} ERROR - Exception on /xcom/list/ [GET]
 Traceback (most recent call last):
   File "/home/airflow/.local/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
     response = self.full_dispatch_request()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
     rv = self.handle_user_exception(e)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
     rv = self.dispatch_request()
          ^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask_appbuilder/security/decorators.py", line 139, in wraps
     return f(self, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask_appbuilder/views.py", line 554, in list
     widgets = self._list()
               ^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask_appbuilder/baseviews.py", line 1177, in _list
     widgets = self._get_list_widget(
               ^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask_appbuilder/baseviews.py", line 1076, in _get_list_widget
     count, lst = self.datamodel.query(
                  ^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 491, in query
     query = self.apply_all(
             ^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 437, in apply_all
     inner_query = self._apply_inner_all(
                   ^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 385, in _apply_inner_all
     query = self.apply_order_by(
             ^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 206, in apply_order_by
     query = query.order_by(asc(_order_column))
                            ^^^^^^^^^^^^^^^^^^
   File "<string>", line 2, in asc
   File "/home/airflow/.local/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 3599, in _create_asc
     coercions.expect(roles.ByOfRole, column),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 177, in expect
     element = element.__clause_element__()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.11/site-packages/sqlalchemy/ext/associationproxy.py", line 441, in __clause_element__
     raise NotImplementedError(
 NotImplementedError: The association proxy can't be used as a plain column expression; it only works inside of a comparison expression

What you think should happen instead

No response

How to reproduce

click on Admin then Xcom then on Execution Date

Operating System

--

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

Code of Conduct

RNHTTR commented 1 year ago

As a workaround in the meantime, sorting by the Run Id or Timestamp columns can probably be used as reasonable proxies.

lurcio commented 8 months ago

I'd like to look into this one as my first issue please

potiuk commented 8 months ago

Sure

raphaelauv commented 4 months ago

@potiuk let's unassigned @lurcio ?

RNHTTR commented 4 months ago

Reproducible on 2.9 as well