Why doesn't BigQuery UI allow setting a destination table if a query uses variables?

ε祈祈猫儿з 提交于 2020-03-05 04:22:28

问题


In BigQuery, I can compose a query and then set a destination table under More > Query Settings. This works as expected for queries without variables, for example:

SELECT * FROM foo.bar WHERE PARSE_TIMESTAMP("%a, %d %b %Y %X %z", date_created) > '2020-01-01 00:00:00';

However, when I try to replace that formatting string with a variable, suddenly the options to set a destination table do not exist under More > Query Settings. For example:

DECLARE date_format STRING DEFAULT "%a, %d %b %Y %X %z";

SELECT * FROM foo.bar WHERE PARSE_TIMESTAMP(date_format, date_created) > '2020-01-01 00:00:00';

Additionally, even when I try to schedule the second query, I do not have an option to set a destination table.

Is this behavior expected? Is it documented anywhere? I have been unable to find an explanation.


回答1:


It is not because of use of parameters per se! But rather limitation of scripting.

So, YES, it is expected - when you use scripting you cannot use destination otherwise you will be getting error

If you need to get result into some table - just use INSERT INTO or any other relevant DML/DDL within your script



来源:https://stackoverflow.com/questions/60128699/why-doesnt-bigquery-ui-allow-setting-a-destination-table-if-a-query-uses-variab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!