Python 使用pgAdmin 3将数据从CSV导入Postgres表

Python 使用pgAdmin 3将数据从CSV导入Postgres表,python,database,postgresql,csv,import,Python,Database,Postgresql,Csv,Import,有人能帮我一下吗?当你运行这些命令时,我得到以下错误: COPY des_unificado (cedula, grupo, nivel, insti, sector, dpto, zona, ccorres, apel_corto, digito_id, nombre, cargo, pres_act, turno, tipo_rubro, catego_psp, cant_rubro, presupuesto_ant, devenga_ant, aporte_ips, aporte_bnt,

有人能帮我一下吗?当你运行这些命令时,我得到以下错误:

COPY des_unificado (cedula, grupo, nivel, insti, sector, dpto, zona, ccorres, apel_corto, digito_id, nombre, cargo, pres_act, turno, tipo_rubro, catego_psp, cant_rubro, presupuesto_ant, devenga_ant, aporte_ips, aporte_bnt, ac_meses, ac_aguinal, f_mm_ing_c, f_aa_ing_c, opera_lqd, tipo_rgtro, status_crg, aa_plan, mm_plan, jubilac, rec_ant, ccorr, orden, antece_nro, resolu_nro, estado, insti_ant, id_grado_c, seccion, id_especia, multa, judicial, afemec, otros_dec, presupuesto, afemec_1, liquido, dcto_jub, monto_defi, aux, linea)
FROM '/home/arturo/Escritorio/des_unificado1.csv' 
WITH DELIMITER ';'
CSV HEADER
**********错误**********

ERROR:  could not open file "/home/arturo/Escritorio/des_unificado1.csv" for reading: No such file or directory

COPY
希望文件位于数据库服务器上,而不是数据库客户端上。因此,如果您连接到另一台计算机上的服务器,并且文件在您的计算机上,则该服务器不存在该文件

如果希望文件位于数据库客户端上,可以使用
psql
命令
\copy
。有关详细信息,请参见
\?


这是
psql
命令行客户端的一部分,而不是服务器。它在内部使用
COPY。。。从STDIN中读取文件,然后通过PostgreSQL连接将其发送到服务器。

如错误所示,您是否看到
/home/arturo/Escritorio/des_unificado1.csv
确实存在?通过执行以下操作验证文件是否存在:ls/code>home/arturo/Escritorio/des_unificado1.csv
您需要包含更多信息—您以什么用户的身份运行命令,您在什么机器上运行命令,postgres在什么机器上运行,权限是什么,您试图导入的文件的所有者和组?告诉我不是Existel文件,而是我是否在桌面上有它@karthikr@EdKing你能帮我吗,我需要这么多的回答,如果它告诉你文件不存在,你需要首先解决这个问题。你是想从数据库复制还是复制到数据库?@Matias在
psql
中使用
\copy
。你能给我你的电子邮件吗,我想发送一个截图@karthikr请给我你的电子邮件,我想发送一个截图@craig ringer Please你可以粘贴一个链接到上传的图片上。@Matias你好像没有在听。您的屏幕截图显示您正在通过pgadmin使用
COPY
。在
psql
中使用
\copy
。如果您使用的是pgadmin,则您没有
\copy
。您必须改用pgadmin的“import”命令,或者使用
psql
命令行客户端。
ERROR: could not open file "/home/arturo/Escritorio/des_unificado1.csv" for reading: No such file or directory
SQL state: 58P01