문제

This might just be a bug in BQ, but maybe someone might be able to call me out on some error. Essentially what I'm trying to do is to add a field (say new_field) to a table and save that as a View to query later.

When I query the view, it throws an error about not being able to find the new_field.

Simplest way to replicate this error:

SELECT IF(corpus_date > 1599, "17th", "16th") AS century, *
FROM [publicdata:samples.shakespeare] 
WHERE corpus_date > 0;

Save As a view, call it bar.

SELECT * FROM [foo.bar]

will throw an error like:

Error: Field 'century' not found in table 'publicdata:samples.shakespeare'.

Any thoughts?

도움이 되었습니까?

해결책

Looks like there is an issue with * expansion in views. I've filed a bug and hopefully we'll be able to get a fix out soon. In the mean time, you should be able to work around the issue by adding all of the fields in the view explicitly.

For example if you save the view as the following:

SELECT IF(corpus_date > 1599, "17th", "16th") AS century, 
    word, word_count, corpus, corpus_date
FROM [publicdata:samples.shakespeare] 
WHERE corpus_date > 0;

then select * from [foo.view] will work.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top