Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Airflow 气流身份验证设置失败,出现“故障”;属性错误:can';t集属性";_Airflow_Apache Airflow - Fatal编程技术网

Airflow 气流身份验证设置失败,出现“故障”;属性错误:can';t集属性";

Airflow 气流身份验证设置失败,出现“故障”;属性错误:can';t集属性";,airflow,apache-airflow,Airflow,Apache Airflow,步骤中所述的Airflow 1.8版密码验证设置失败 user.password = 'set_the_password' 错误地 AttributeError: can't set attribute 这是由于SqlAlchemy更新到>=1.2版本,该版本引入了向后不兼容的更改 您可以通过显式安装SqlAlchemy版本来修复此问题 pip install 'sqlalchemy<1.2' pip install'sqlalchemy最好只使用PasswordUser的新方法\u

步骤中所述的Airflow 1.8版密码验证设置失败

user.password = 'set_the_password'
错误地

AttributeError: can't set attribute

这是由于SqlAlchemy更新到>=1.2版本,该版本引入了向后不兼容的更改

您可以通过显式安装SqlAlchemy版本来修复此问题

pip install 'sqlalchemy<1.2'

pip install'sqlalchemy最好只使用PasswordUser的新方法
\u set\u password

 # Instead of user.password = 'password'
 user._set_password = 'password'

如果有人想知道SQLAlchemy 1.2(在@DanT的回答中提到)中不兼容的变化实际上是什么,那么这就是SQLAlchemy如何处理混合属性的变化。从1.2开始,方法必须与原始混合方法具有相同的名称,这在以前是不需要的。对气流的修正非常简单。
contrib/auth/backends/password\u auth.py
中的代码应更改为:

@password.setter
    def _set_password(self, plaintext):
        self._password = generate_password_hash(plaintext, 12)
        if PY3:
            self._password = str(self._password, 'utf-8')
为此:

@password.setter
    def password(self, plaintext):
        self._password = generate_password_hash(plaintext, 12)
        if PY3:
            self._password = str(self._password, 'utf-8')

有关更多详细信息,请参阅。

气流确实对SQLA设置了版本要求-设置为
=1.1
-只是SQLA在1.1和1.2之间进行了向后不兼容的更改。1.2的发布时间比气流的发布时间要晚。检查时出错,我将编辑答案。谢谢。不过,sql alchemy建议设置密码的方式是什么?
@password.setter
    def _set_password(self, plaintext):
        self._password = generate_password_hash(plaintext, 12)
        if PY3:
            self._password = str(self._password, 'utf-8')
@password.setter
    def password(self, plaintext):
        self._password = generate_password_hash(plaintext, 12)
        if PY3:
            self._password = str(self._password, 'utf-8')