bq-load - 解析从以下位置开始的行时检测到错误:1830577。错误:关闭双引号 (") 和字段分隔符之间的数据
问题描述
我试图将表从 Teradata 加载到 BQ。我的管道首先将表数据导出到 gcs 位置,然后使用 bqload,将数据从 gs:// 加载到 bq 表。
我的 bqload 看起来像这样
bq load --autodetect --source_format=CSV --project_id=xx-xx-xx --field_delimiter='^' \
BQTable \
gs:// \
Name:string,Age:INT64,Place:NUMERIC ...
但是当我尝试使用 bq load 将数据加载到 bq 表中时出现以下错误
Error detected while parsing row starting at position: 1830577. Error: Data between
close double quote (") and field separator.
我尝试在 bqload 命令中使用几个选项,例如 --quote ="" ,当我使用它时,它给了我一个不同的错误,如下所示
Could not parse 'MP' as NUMERIC for field XXXXXX (position 18) starting at
location 1030399 with message 'Invalid NUMERIC value: MP'
也玩了很长时间其他选项,但没有给我任何结果。有人可以发光吗?
解决方案
不确定是否仍然活跃的问题,但也许它会在未来帮助某人。
看起来有些数据错误地用双引号括起来(例如123,"some" data,456
)。这可能是由转义特殊字符引起的 - 在此处查看有关带双引号的数据的更多信息:Properly escape a double quote in CSV
和此处:
https ://gpdb.docs.pivotal.io/43250/admin_guide/load/topics/g-转义-in-csv-formatted-files.html
请注意,默认情况下,NULL 值也会用 " 转义,这可能会导致一些额外的麻烦,例如:例如123,"NULL,"some text value in quotes",456
,"NULL" 将被解释为字符串值,而 'some text...' 会抛出
Error: Data between close double quote (") and field separator.
您应该从 .csv 文件中删除任何"NULL
内容,使其看起来像这样:
123,,"some text value in quotes",456
推荐阅读
- express - 我可以使用 Express res.sendFile() 发送 XLS/XLSX 文件吗?
- javascript - 如何将我的 expo 应用程序发布到 Apple 应用商店?
- json - 将 pandas 数据帧转换为具有特定格式的 json
- javascript - 如何在产品列表中添加切换“全部显示”、“全部隐藏”
- python - 为什么这没有返回预期的升序?
- spring-boot - Springboot + Elastic Search:如何构建模糊的 LIKE 查询?
- javascript - 来自数组的动态 HTML 行
- amazon-s3 - AWS 胶水将动态帧写入内存不足 (OOM)
- haskell - 是否有一个 Monad 收集结果并将其映射到它们?
- delphi - 未声明的标识符 soAllDirectories