使用python脚本在使用postgresql的复制命令(Amazon Redshift)时跳过固定宽度文件中的坏行
我正在使用psycopg2连接到红移数据库。我想运行复制查询以将固定宽度文件加载到表中,但是其中一些文件的行中有错误。复制当前在第一个错误上断开,我想使用python脚本跳过这些不良行,记录错误并继续加载数据。 这是否建议(如良好的实践/大会)吗?如果是这样,我该如何处理?
I am using psycopg2 to connect to a redshift database. I would like to run COPY queries to load fixed width files into tables, but some of these files have rows with errors in them. COPY currently breaks on the first error, and I would like to use a python script to skip these bad rows, log the error, and continue loading the data.
Is this advisable (as in good practice/convention)? If it is, how do I go about it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论