【问题标题】:Error detected while parsing row starting at position: 1830577. Error: Data between close double quote (") and field separator解析从以下位置开始的行时检测到错误:1830577。错误:关闭双引号 (") 和字段分隔符之间的数据
【发布时间】:2020-12-15 17:58:13
【问题描述】:

我正在尝试将表从 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'

也玩了很长时间的其他选项,但没有给我任何结果。有人可以发光吗?

【问题讨论】:

    标签: bq-load


    【解决方案1】:

    不确定是否仍然是活跃的问题,但也许将来会对某人有所帮助。

    似乎有一些数据被错误地用双引号括起来(例如123,"some" data,456)。 这可能是由转义特殊字符引起的 - 在此处查看有关双引号数据的更多信息:Properly escape a double quote in CSV 和这里: https://gpdb.docs.pivotal.io/43250/admin_guide/load/topics/g-escaping-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

    【讨论】:

      猜你喜欢
      • 2021-03-14
      • 2022-01-22
      • 2012-09-07
      • 2015-08-05
      • 2020-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-15
      相关资源
      最近更新 更多