SQL Google BigQuery <EOF> 中的错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38792695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 04:46:15  来源:igfitidea点击:

Error in Google BigQuery <EOF>

sqlgoogle-bigquerydata-visualization

提问by Francesco Bria

I am new to Google BigQuery. I need help with the query error:

我是 Google BigQuery 的新手。我需要有关查询错误的帮助:

"Encountered " "WITH" "with "" at line 1, column 1. Was expecting: EOF"

“在第 1 行,第 1 列遇到”“与”“与”。期待:EOF”

with
  t1 as 
  (
    select
    date(USEC_TO_TIMESTAMP(event_dim.timestamp_micros)) date, event_dim.name
    from
    [myfoody-1313:it_rawfish_myfoody_ANDROID.app_events_20160727]
    where
    event_dim.name='pv_detail' and event_dim.params.key='item_id' and
    event_dim.params.value.string_value='31'
  )
  select
  date(d) as day, count(event_dim.name)
from
  generate_series(current_date - interval '6 day', current_date, '1 day') d
  left join t1 on t1.date = d
group by day
order by day;

回答by Mikhail Berlyant

I need help on a query error: "Encountered " "WITH" "with "" at line 1, column 1. Was expecting: EOF"

我需要有关查询错误的帮助:在第 1 行,第 1 列,“遇到”“与”“与“”。期待:EOF”

WITH is supported for BigQuery Standard SQL - see Enabling Standard SQL- you should enable Standard SQL

BigQuery 标准 SQL 支持 WITH - 请参阅启用标准 SQL- 您应该启用标准 SQL

回答by Ilya Zinkevych

Under Show Optionsuncheck Use Legacy Sql

显示选项下取消选中使用旧版 Sql

回答by SANN3

We also getting the same exception while running the query via Java SDK, to fix it we passed table name like `project_id.dataset_id.table`

我们在通过 Java SDK 运行查询时也遇到相同的异常,为了修复它,我们传递了表名,如 `project_id.dataset_id.table`

回答by Kumar Pankaj

To access BQ using Terminal command:

使用终端命令访问 BQ:

For Ignoring these cases: "Encountered", "WITH", "with" at line 1, column 1. "Was expecting: EOF"

对于忽略这些情况:“遇到”,“与”,“与”在第 1 行,第 1 列。“期待:EOF”

Use: --use_legacy_sql=false

用: --use_legacy_sql=false

Normal Query example from the terminal:

终端的正常查询示例:

bq query --use_legacy_sql=false 'SELECT * from `table_name` where published_date >= "2020-05-05" limit 10;'