使用 bq 将空值加载到 bigquery [英] Loading nulls into bigquery with bq

查看:26
本文介绍了使用 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 并在可能丢失的列上使用模式为 null 的模式时,同一文件被拒绝,因为列数与模式中的列数不同.

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 工具让我将空值作为空值上传到可空列中?

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.

这篇关于使用 bq 将空值加载到 bigquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆