fe_sendauth:Composer 中没有提供密码
Posted
技术标签:
【中文标题】fe_sendauth:Composer 中没有提供密码【英文标题】:fe_sendauth: no password supplied in Composer 【发布时间】:2020-02-17 09:21:21 【问题描述】:我正在尝试在新的作曲家环境中创建 DAG 以测试与 Postgres 数据库的连接。但我在气流中收到fe_sendauth: no password supplied
错误。我可以使用相同的 conn_id(无密码)在我们的旧作曲家环境中连接到这个数据库。
from airflow.operators.postgres_operator import PostgresOperator
from airflow.models import DAG, configuration
from airflow.utils.dates import days_ago
dag_params =
'dag_id': 'test_postgres_yellow_connection',
'start_date': days_ago(1),
'schedule_interval': None
with DAG(**dag_params) as dag:
check_count = PostgresOperator(
task_id="check_count",
postgres_conn_id='postgres_yellow',
sql="""
select count(1) from db_name.table_name;
"""
)
check_count
这是气流日志:
[2020-02-17 06:01:17,142] base_task_runner.py:101 INFO - Job 1403: Subtask check_count [2020-02-17 06:01:17,142] postgres_operator.py:57 INFO - Executing:
[2020-02-17 06:01:17,143] base_task_runner.py:101 INFO - Job 1403: Subtask check_count select count(1) from db_name.table_name;
[2020-02-17 06:01:17,143] base_task_runner.py:101 INFO - Job 1403: Subtask check_count
[2020-02-17 06:01:17,165] base_task_runner.py:101 INFO - Job 1403: Subtask check_count [2020-02-17 06:01:17,165] base_hook.py:83 INFO - Using connection to: id: postgres_yellow. Host: hotname, Port: xxx, Schema: schema_name, Login: xxxx, Password: None, extra:
[2020-02-17 06:01:17,217] models.py:1846 ERROR - fe_sendauth: no password supplie
Traceback (most recent call last)
File "/usr/local/lib/airflow/airflow/models.py", line 1714, in _run_raw_tas
result = task_copy.execute(context=context
File "/usr/local/lib/airflow/airflow/operators/postgres_operator.py", line 60, in execut
self.hook.run(self.sql, self.autocommit, parameters=self.parameters
File "/usr/local/lib/airflow/airflow/hooks/dbapi_hook.py", line 158, in ru
with closing(self.get_conn()) as conn
File "/usr/local/lib/airflow/airflow/hooks/postgres_hook.py", line 60, in get_con
self.conn = psycopg2.connect(**conn_args
File "/opt/python3.6/lib/python3.6/site-packages/psycopg2/__init__.py", line 126, in connec
conn = _connect(dsn, connection_factory=connection_factory, **kwasync
psycopg2.OperationalError: fe_sendauth: no password supplied
【问题讨论】:
【参考方案1】:可能您的旧环境用户在您的pg_hba.conf
文件中设置为可信任用户。正如您在 trust 身份验证方法中看到的here:
无条件允许连接。这种方法允许任何人 可以连接到 PostgreSQL 数据库服务器以任何方式登录 他们希望的 PostgreSQL 用户,无需密码或任何 其他认证。有关详细信息,请参阅第 19.3.1 节。
如果对你有帮助,请告诉我
【讨论】:
以上是关于fe_sendauth:Composer 中没有提供密码的主要内容,如果未能解决你的问题,请参考以下文章
fe_sendauth:Ruby没有提供密码(PG :: ConnectionBad),但在Rails中没问题
如何修复:PG::ConnectionBad:fe_sendauth:未提供密码
django.db.utils.OperationalError:fe_sendauth:未提供密码