引号和字段分隔符之间的数据

sha*_*nuo 9 google-bigquery

在下面给出的示例中,未上传最后一行.我收到一个错误:

Data between close double quote (") and field separator: 
Run Code Online (Sandbox Code Playgroud)

这看起来像一个bug,因为管道符号之间的所有数据都应该被视为一个字段.

Schema: one:string,two:string,three:string,four:string

上传文件:

This | is | test only | to check quotes
second | line | "with quotes" | no text
third line | with | "start quote" and | a word after quotes
Run Code Online (Sandbox Code Playgroud)

处理上面的第一行和第二行.但不是第三个.


更新:

有人可以解释为什么以下工作除了第三行?

This | is | test only | to check quotes
second | line | "with quotes" | no text
third line | with | "start quote" and | a word after quotes
forth line | enclosed | {"GPRS","MCC_DETECTED":false,"MNC_DETECTED":false} | how does this work?
fifth line | with | {"start quote"} and | a word after quotes
Run Code Online (Sandbox Code Playgroud)

可以有一些奇特的解释.从最终用户的角度来看,这是荒谬的.

Mic*_*hri 9

从CSV RFC4180页面:"如果使用双引号括起字段,那么出现在字段内的双引号必须通过在其前面加上另一个双引号来转义."

你可能想这样做:

This | is | test only | to check quotes
second | line | "with quotes" | no text
third line | with | " ""start quote"" and " | a word after quotes
Run Code Online (Sandbox Code Playgroud)

更多关于我们的CSV输入格式在这里.

  • 请注意,您可以通过将加载作业配置中的"quote"字段设置为您永远不会使用的字符来更改引号字符. (4认同)

小智 6

-- 报价工作完美。

bq load 
--source_format CSV --quote "" 
--field_delimiter \t 
--max_bad_records 10 
-E UTF-8   
destination table
Source files 
Run Code Online (Sandbox Code Playgroud)