错误:无法统计文件“ XX.csv”:未知错误 [英] ERROR: could not stat file "XX.csv": Unknown error

查看:177
本文介绍了错误:无法统计文件“ XX.csv”:未知错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行以下命令:

 使用'FORMAT CSV,HEADER TRUE从'D:/XXX.csv'复制XXX ,NULL'NULL')

在Windows 7中,它成功导入了小​​于1GB的CSV文件。 / p>

如果文件大于1GB,我会收到未知错误。

  [代码:0,SQL状态:XX000]错误:无法统计文件'D:/XXX.csv'未知错误

如何解决此问题?

解决方案

https://github.com/MIT-LCP/mimic-code/issues/493
alistairewj评论了2018年11月3日•►
编辑了



好的,无法统计文件 CHARTEVENTS.csv:未知错误实际上是一个错误PostgreSQL 11.在后台,它调用fstat()以确保文件不是目录,但不幸的是fstat()是32位程序,无法处理诸如图表事件。我使用PostgreSQL 10.5在Windows上测试了该版本,但没有收到此错误,因此我认为它是相当新的。



最好的解决方法是保持文件压缩(即将其保存为.csv.gz文件),然后使用7zip直接从压缩文件中加载数据。在测试中,这似乎仍然有效。这里有一个关于如何执行此操作的非常详细的教程: https:// mimic .physionet.org / tutorials / install-mimic-locally-windows /



上面的简短版本是您保留.csv.gz文件,您将7zip二进制文件添加到Windows环境路径中,然后调用postgres_load_data_7zip.sql文件以加载数据。您可以在所有内容之后使用postgres_checks.sql文件,以确保正确加载了所有数据。



编辑:对于以后的错误,您正在使用7zip方法,我不确定为什么不加载。尝试仅重新下载ADMISSIONS.csv.gz文件,看看它是否仍然引发相同的错误。也许有7zip的新版本需要我更新脚本或其他内容!


I run this command:

COPY XXX FROM 'D:/XXX.csv'  WITH (FORMAT CSV, HEADER TRUE, NULL 'NULL')

In Windows 7, it successfully imports CSV files of less than 1GB.

If the file is more then 1GB big, I get an “unknown error”.

[Code: 0, SQL State: XX000]  ERROR: could not stat file "'D:/XXX.csv'  Unknown error

How can I fix this issue?

解决方案

https://github.com/MIT-LCP/mimic-code/issues/493 alistairewj commented Nov 3, 2018 • ► edited

Okay, the could not stat file "CHARTEVENTS.csv": Unknown error is actually a bug in PostgreSQL 11. Under the hood it makes a call to fstat() to make sure the file is not a directory, and unfortunately fstat() is a 32-bit program which can't handle large files like chartevents. I tested the build on Windows with PostgreSQL 10.5 and I didn't get this error so I think it's fairly new.

The best workaround is to keep the files compressed (i.e. keep them as .csv.gz files) and use 7zip to load in the data directly from compressed files. In testing this seemed to still work. There is a pretty detailed tutorial on how to do this here: https://mimic.physionet.org/tutorials/install-mimic-locally-windows/

The brief version of above is that you keep the .csv.gz files, you add the 7zip binary to your windows environment path, and then you call the postgres_load_data_7zip.sql file to load in the data. You can use the postgres_checks.sql file after everything to make sure you loaded in all the data correctly.

edit: For your later error, where you are using this 7zip approach, I'm not sure why it's not loading. Try redownloading just the ADMISSIONS.csv.gz file and seeing if it still throws you that same error. Maybe there is a new version of 7zip which requires me to update the script or something!

这篇关于错误:无法统计文件“ XX.csv”:未知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆