BigQuery将查询结果附加到带有必填字段的表中 [英] BigQuery append results of query to table with Required fields

查看:85
本文介绍了BigQuery将查询结果附加到带有必填字段的表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将查询结果追加到与查询结果具有相同架构的现有表中,只是现有表中的某些字段是必需的.

I am trying to append the results of a query to an existing table that has the same schema as the result of the query, except that some of the fields in the existing table are required.

当我尝试运行查询时,这是所有必填字段的错误:

This is the error for all the required fields when I try and run the query:

Invalid schema update. Field user has changed mode from REQUIRED to NULLABLE

当我将查询结果写入新表时,其所有字段的名称和类型相同,但是所有字段的模式均为NULLABLE(重复的字段除外1).我尝试对所有必填字段使用AND user IS NOT NULL,但没有运气.我还尝试过将查询结果保存到单独的表中,然后修改其架构,但是BQ不允许在表上追溯设置必填字段.

When I write the results of the query to a new table it has the same name and types for all the fields, however the mode for all the fields is NULLABLE (except for 1 repeated field). I've tried using AND user IS NOT NULL for all the required fields with no luck. I've also tried saving the results of the query to a separate table then modifying its schema, but BQ doesn't allow required fields to be set retroactively on a table.

推荐答案

Standard SQL不再支持REQUIRED字段.如果您使用的是标准SQL(而不是传统SQL),他们建议您

REQUIRED fields are no longer supported in Standard SQL. If you're using Standard SQL (as opposed to Legacy SQL), they recommend you change all your REQUIRED fields to NULLABLE.

编辑(10/23/2017):看起来他们已经添加了对标准SQL中的必填字段.

Edit (10/23/2017): Looks like they've added support for REQUIRED fields in Standard SQL.

这篇关于BigQuery将查询结果附加到带有必填字段的表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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