简体   繁体   English

PostgreSQL错误-psql:fe_sendauth:未提供密码

[英]PostgreSQL Error - psql: fe_sendauth: no password supplied

I have PostgreSQL setup in AWS RDS with database name as some_files . 我在AWS RDS中具有数据库名称为some_files PostgreSQL设置。
Username of DB is mobileuser . DB的用户名是mobileuser It has been given superuser privileges 它已被赋予超级用户权限

I want to copy csv file in table called data_table on daily basis. 我想每天在名为data_table表中复制csv文件。 So, I wrote a python script (using psycopg2) which would connect to this database and copy it. 因此,我编写了一个python脚本(使用psycopg2),该脚本将连接到该数据库并进行复制。 I tried using COPY command. 我尝试使用COPY命令。 But received an error 但是收到一个错误

COPY mobile user.data_table FROM 'csv_location';

It gave me error that I need to be superuser to perform this action. 它给我一个错误,我需要成为超级用户才能执行此操作。 According to https://forums.aws.amazon.com/thread.jspa?threadID=141798 根据https://forums.aws.amazon.com/thread.jspa?threadID=141798

RDS is a managed service and in order to prevent situations that compromise that service, localhost access is not permitted. The Postgres "COPY" command causes the server itself to read/write files -- potentially directly on the Postgres host. Therefore it is restricted. An alternative is to use the client based, psql instruction "\\copy". Documentation for that command can be found in the Postgres online manual.

So I tried using \\copy command using psql 所以我尝试使用psql使用\\copy命令

terminal_command = "psql -h rds_hostname -U mobileuser -w -d some_files -c \copy "+schema_name+"."+table_name+" FROM 'csv_location' DELIMITER '|' CSV HEADER"
subprocess.call(terminal_command,shell=True)

I added .pgpass file to my home directory *:*:*:*:my_password with permissions as 600 我将.pgpass文件添加到我的主目录*:*:*:*:my_password ,权限为600

Still, it gives me error psql: fe_sendauth: no password supplied I am running python script using root user 尽管如此,它仍然给我错误psql: fe_sendauth: no password supplied我正在使用root用户运行python脚本

While you are ... 当你...

running the python script as root user root用户身份运行python脚本

(why?) the .pgpass file has to be in the home directory of root , not the home directory of your user account. (为什么?). .pgpass文件必须位于root的主目录中, 而不是用户帐户的主目录中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Django 4 使用密码文件连接到 Postgresql:“fe_sendauth:未提供密码” - Django 4 connection to Postgresql using passfile: "fe_sendauth: no password supplied" Python 和 Postgresql:OperationalError:fe_sendauth:未提供密码 - Python and Postgresql: OperationalError: fe_sendauth: no password supplied AWS-DJANGO-格式错误:OperationalError:fe_sendauth:未提供密码 - AWS - DJANGO - Error in formatting: OperationalError: fe_sendauth: no password supplied fe_sendauth:Composer 中没有提供密码 - fe_sendauth: no password supplied in Composer 将postgres作为Docker服务运行时,“psql:fe_sendauth:没有提供密码” - “psql: fe_sendauth: no password supplied” when running postgres as a Docker service psycopg2.OperationalError:fe_sendauth:未提供密码 - psycopg2.OperationalError: fe_sendauth: no password supplied SQLAlchemy (psycopg2.OperationalError) fe_sendauth:未提供密码 - SQLAlchemy (psycopg2.OperationalError) fe_sendauth: no password supplied Django fe_sendauth:未提供密码错误,无法连接到 postgres 数据库 - Django fe_sendauth: no password supplied error, unable to connect to postgres database 使用带有Postgres引擎的AWS Aurora数据库收到“ fe_sendauth:未提供密码”错误,但仅在执行单元测试时出现 - Receiving 'fe_sendauth: no password supplied' error using AWS Aurora database with Postgres engine, but only when performing unit tests django.db.utils.OperationalError:fe_sendauth:迁移 django 应用程序时未提供密码 - django.db.utils.OperationalError: fe_sendauth: no password supplied when migrating django app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM