Apache Airflow "наивный datetime запрещен" в веб-интерфейсе - PullRequest
0 голосов
/ 31 октября 2018

В веб-интерфейсе Airflow под /admin/taskinstance/ я пытаюсь выполнить фильтрацию по дате выполнения, для которой требуется параметр datetime. Он даже предлагает календарь и время для заполнения автоматически. enter image description here

Я получаю эту ошибку при нажатии Отправить с фильтром даты и времени.

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1116, in _execute_context
    context = constructor(dialect, self, conn, *args)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 649, in _init_compiled
    for key in compiled_params
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 649, in <genexpr>
    for key in compiled_params
  File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/type_api.py", line 1078, in process
    return process_param(value, dialect)
  File "/usr/lib/python3.6/site-packages/airflow/utils/sqlalchemy.py", line 156, in process_bind_param
    raise ValueError('naive datetime is disallowed')
ValueError: naive datetime is disallowed

Вышеуказанное исключение было прямой причиной следующего исключения:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python3.6/site-packages/flask_admin/base.py", line 69, in inner
    return self._run_view(f, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/flask_admin/base.py", line 368, in _run_view
    return fn(self, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/flask_admin/model/base.py", line 1818, in index_view
    view_args.search, view_args.filters)
  File "/usr/lib/python3.6/site-packages/flask_admin/contrib/sqla/view.py", line 969, in get_list
    count = count_query.scalar() if count_query else None
  File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2843, in scalar
    ret = self.one()
  File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2814, in one
    ret = self.one_or_none()
  File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2784, in one_or_none
    ret = list(self)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1121, in _execute_context
    None, None)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1116, in _execute_context
    context = constructor(dialect, self, conn, *args)
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 649, in _init_compiled
    for key in compiled_params
  File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 649, in <genexpr>
    for key in compiled_params
  File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/type_api.py", line 1078, in process
    return process_param(value, dialect)
  File "/usr/lib/python3.6/site-packages/airflow/utils/sqlalchemy.py", line 156, in process_bind_param
    raise ValueError('naive datetime is disallowed')
sqlalchemy.exc.StatementError: (builtins.ValueError) naive datetime is disallowed [SQL: 'SELECT count(%(count_2)s) AS count_1 \nFROM task_instance \nWHERE task_instance.execution_date = %(execution_date_1)s'] [parameters: [{}]]

Кажется, что Airflow не может ввести формат даты из веб-интерфейса пользователя. Я пробовал любой формат даты и времени, который только мог придумать, но все равно не повезло.

Кто-нибудь может помочь с этим?

...