【发布时间】:2018-09-19 12:10:23
【问题描述】:
我有一个关于在谷歌大查询中提取自定义维度的问题。 已经有人问过这个问题,但是,解决方案不起作用..
问题是,当我尝试像这样提取自定义维度的信息时
SELECT
fullvisitorId,
visitid,
hit.hitnumber,
(SELECT x.value FROM UNNEST(hit.customDimensions) x WHERE x.index = 1) as productCategory,
(SELECT x.value FROM UNNEST(hit.customDimensions) x WHERE x.index = 2) as loyaltyClass,
(SELECT x.value FROM UNNEST(hit.customDimensions) x WHERE x.index = 3) as existingCustomer
FROM [<id>.ga_sessions_20180805],UNNEST(hits) as hit
LIMIT 100
然后我收到一个错误“无法解析表名“命中”:数据集名称丢失。”
我尝试过像这样使用其他人的解决方案
SELECT
fullvisitorId,
visitid,
hit.hitnumber,
(SELECT x.value FROM UNNEST(hit.customDimensions) x WHERE x.index = 1) as productCategory,
(SELECT x.value FROM UNNEST(hit.customDimensions) x WHERE x.index = 2) as loyaltyClass,
(SELECT x.value FROM UNNEST(hit.customDimensions) x WHERE x.index = 3) as existingCustomer
FROM `<id>.ga_sessions_*`, UNNEST(hits) AS h
WHERE _TABLE_SUFFIX = '20180805'
然后我得到另一个错误 Invalid table name: <id>.ga_sessions_* [Try using standard SQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql)].
更新:我什至尝试了最基本的查询
SELECT
*
FROM [<id>.ga_sessions_20180805]
LEFT JOIN UNNEST(hits) as hits
LIMIT 10
仍然返回相同的错误....
我对这两个脚本都犯了什么错误?以及如何获得自定义维度值?
非常感谢!
【问题讨论】:
标签: sql google-bigquery custom-dimensions