Error in Google BigQuery <EOF>

不问归期 提交于 2020-05-26 10:38:33

问题


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

"Encountered " "WITH" "with "" at line 1, column 1. Was expecting: 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;

回答1:


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

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




回答2:


Under Show Options uncheck Use Legacy Sql




回答3:


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`




回答4:


To access BQ using Terminal command:

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

Use: --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;'


来源:https://stackoverflow.com/questions/38792695/error-in-google-bigquery-eof

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