newbie bigquery how to select multiple parameters from an firebase event (schema record, repeated)

ε祈祈猫儿з 提交于 2019-12-01 04:16:48

问题


I am trying to select to parameters from firebase events named "SCI_ERROR"

I am new new Firebase and BigQuery. I watched the Firebase BigQuery video tutorial. I think maybe it is a little out of date? I tried using several posted solutions I found on stackOverflow. I could never run them because of errors.

I assume best practice is use the 'standard query' syntax.

I think where I am running into trouble is that all the examples I have seen suggest there is a table 'event_dims' . when I look at the schema I see event_name and event_params

Here is my sql statement

SELECT 
(SELECT value.string_value FROM x
                             WHERE key = 'TITLE') AS level_id,
(SELECT value.string_value FROM x
                             WHERE key = 'url') AS url
FROM `sci.analytics_179015875.events_20180725` ,
  UNNEST(event_params) as x
WHERE event_name = 'SCI_ERROR'

Here is the error

Error: Table name "x" cannot be resolved: dataset name is missing.

Thanks in advance

Andy


回答1:


Below is for BigQuery Standard SQL

#standardSQL
SELECT 
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'TITLE') AS level_id,
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'url') AS url
FROM `sci.analytics_179015875.events_20180725`
WHERE event_name = 'SCI_ERROR'


来源:https://stackoverflow.com/questions/51563454/newbie-bigquery-how-to-select-multiple-parameters-from-an-firebase-event-schema

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