【发布时间】:2022-11-03 22:43:23
【问题描述】:
我有一个复杂的 BigQuery 视图,它从各种连接的 Google 表格中提取数据以及 BigQuery 中的计算数据。我正在尝试在 Data Studio 中的视图之上创建一个仪表板。
我在让我的数据显示在 Data Studio 中并将其隔离到 BigQuery 基础视图的特定部分时遇到问题。
我有一个较早的问题,this question 已回答。
我正在有效地运行该帖子中的查询,保存为视图,然后连接到 Data Studio。
SELECT order_id, order_date,
ARRAY_AGG(line_item) AS line_items
FROM (
SELECT order_id, order_date,
STRUCT(item_sku,
item_quantity,
item_subtotal,
cost.product_cost) AS line_item
FROM `order_data_table`, UNNEST(line_items) AS items
JOIN `price_history_table` AS cost
ON items.item_sku = cost.sku AND effective_date < order_date
QUALIFY 1 = ROW_NUMBER() OVER(PARTITION BY order_id, order_date, item_sku ORDER BY effective_date DESC)
)
GROUP BY order_id, order_date
此查询使用窗口函数,正是这导致了我的问题。每当我尝试连接到数据时,我都会得到这个。
随着细节
数据洞察无法连接到您的数据集。
无法从底层数据集中获取数据
从查询中删除以下行可以解决问题,但是我没有所需的数据。
QUALIFY 1 = ROW_NUMBER() OVER(PARTITION BY order_id, order_date, item_sku ORDER BY effective_date DESC)这是否会破坏 Data Studio?我可以避免吗?我可以用不使用窗口函数的不同方式解决原始问题吗?
更新
好像有一个issue in Data Studio where it does not support the QUALIFY function.
关于如何在不使用 QUALIFY 的情况下重写此查询的任何建议?
【问题讨论】:
-
如果您直接在 BigQuery 上运行查询,它是否有效?您是否检查过 BigQuery 中的查询历史记录是否有任何错误?
-
是的,在 BigQuery 中一切正常。从 Data Studio 连接时也没有记录错误。
标签: google-bigquery google-data-studio