气流 2.2.3 sqlalchemy 兼容库

airflow 2.2.3 sqlalchemy compatible libraries

以下哪个库版本适用于 Airflow 2.2.3?

尝试了几个选项,但 none 有效。初始化 db

时失败

解决方法:降级无果 pip 安装 Flask==1.0.4 pip3 安装 marshmallow-sqlalchemy==0.17.1

解决方案:无结果 pip3 安装 marshmallow-sqlalchemy==0.17.1 pip3 安装 SQLAlchemy==1.3.23 pip3 安装 flask-sqlalchemy

错误: flask-appbuilder 3.4.3 需要 marshmallow-sqlalchemy<0.27.0,>=0.22.0,但您将拥有不兼容的 marshmallow-sqlalchemy 0.17.1。 apache-airflow 2.2.3 需要 flask<2.0,>=1.1.0,但您将拥有不兼容的 flask 1.0.4。 apache-airflow 2.2.3 需要 werkzeug>=1.0.1,~=1.0,但您将拥有不兼容的 werkzeug 0.16.0。

使用更高版本会产生不同的错误。


- name: "pip : ensure correct werkzeug package present"
  pip:
    name: "werkzeug"
    version: "{{ airflow_werkzeug_version | default('0.16.0') }}"
    state: present
    virtualenv: "{{ airflow_venv_path }}"
    virtualenv_command: "{{ airflow_venv_cmd }}"
  environment:
    AIRFLOW_GPL_UNIDECODE: "yes"
    SLUGIFY_USES_TEXT_UNIDECODE: "yes"
  become: true
  become_user: "{{ airflow_username }}"

- name: "venv - ensure python sqlalchemy dependencies "
  pip:
    name: "Flask-SQLAlchemy"
    version: "2.4.4"
    state: present
    virtualenv: "{{ airflow_venv_path }}"
    virtualenv_command: "{{ airflow_venv_cmd }}"
  environment:
    AIRFLOW_GPL_UNIDECODE: "yes"
    SLUGIFY_USES_TEXT_UNIDECODE: "yes"
  become: true
  become_user: "{{ airflow_username }}"

- name: "venv - ensure python sqlalchemy dependencies "
  pip:
    name: "SQLAlchemy"
    version: "1.3.23"
    state: present
    virtualenv: "{{ airflow_venv_path }}"
    virtualenv_command: "{{ airflow_venv_cmd }}"
  environment:
    AIRFLOW_GPL_UNIDECODE: "yes"
    SLUGIFY_USES_TEXT_UNIDECODE: "yes"
  become: true
  become_user: "{{ airflow_username }}"

- name: "venv - ensure python sqlalchemy dependencies "
  pip:
    name: "wtforms"
    version: "2.3.3"
    state: present
    virtualenv: "{{ airflow_venv_path }}"
    virtualenv_command: "{{ airflow_venv_cmd }}"
  environment:
    AIRFLOW_GPL_UNIDECODE: "yes"
    SLUGIFY_USES_TEXT_UNIDECODE: "yes"
  become: true
  become_user: "{{ airflow_username }}"

查看约束文件。只要您使用由 Airflow 维护者在每个版本中生成的黄金约束集,您就不必考虑正确的依赖项版本。

请参阅关于此的 Airflow 文档:

https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html

应该在安装 airflow 时使用约束 - 这样 PIP 将自动找到并安装正确的版本。

但您也可以 - 如果您想要手动设置这些依赖项,甚至自动进行版本检索。例如,这里有 Airflow 2.2.2 和 Python 3.7:

的一组“黄金”约束

https://raw.githubusercontent.com/apache/airflow/constraints-2.2.3/constraints-3.7.txt