我有一个关于在谷歌大查询中提取自定义维度的问题。有些人已经问过这个问题,但是,解决方案不起作用..
问题是,当我尝试像这样提取自定义维度的信息时
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
仍然返回相同的错误....
我为这两个脚本犯了什么错误?以及如何获得自定义维度值?
非常感谢!