用bq将空值加载到bigquery中

用bq将空值加载到bigquery中

问题描述:

当我使用 https://developers.google .com / bigquery / docs / reference / v2 / tables / insert#try-it 上传JSON文件并不是所有字段都插入所有列,它被接受,我的数据中有空值。

When I use https://developers.google.com/bigquery/docs/reference/v2/tables/insert#try-it to upload a JSON file with not all fields inserted in all columns, it is accepted and I get nulls in my data.

当我使用bq load并且有可能缺少列的模式为空的模式时,同一个文件被拒绝,因为列数不同于模式。

When I use bq load and have a schema with mode nullable on possibly missing columns, the same file is rejected because there are different numbers of columns than in the schema.

如果我将这些列添加到JSON中并将它们设置为null,则会出现错误,因为bq无法将其转换为字符串。

If I add those columns to the JSON and set them to have a value null, I get an error because bq can't convert that to a string.

如果我将这些列添加到JSON并设置它们的值为'',那么上传过程就会很顺利......但现在我有空字符串而不是空字符串。这不是我想要的。

If I add those columns to the JSON and set them to have a value '' then the upload proceeds just fine..but now I have empty strings rather than null. Which is not what I want.

如何告诉bq工具让我将NULL作为空值上传到可为空的列中?

How can I tell the bq tool to let me upload nulls as nulls into a nullable column?

这是一个错误,一个修复应该很快出来。

This is a bug, a fix should be out soon.