google-bigquery - 如何在 Google BigQuery Composer 和 Cloud Shell 中提交多个查询
问题描述
只是一个简单的问题,请不要告诉我在 Query Composer 和 Google Cloud Shell 中不支持提交多个查询。
当我提交两个语句时(例如,由“;”分隔的 drop table 语句),它告诉我下一行的 drop word 是意外的。
解决方案
BigQuery 现在支持多语句执行。查看脚本文档。复制示例:
-- Declare a variable to hold names as an array.
DECLARE top_names ARRAY<STRING>;
-- Build an array of the top 100 names from the year 2017.
SET top_names = (
SELECT ARRAY_AGG(name ORDER BY number DESC LIMIT 100)
FROM `bigquery-public-data`.usa_names.usa_1910_current
WHERE year = 2017
);
-- Which names appear as words in Shakespeare's plays?
SELECT
name AS shakespeare_name
FROM UNNEST(top_names) AS name
WHERE name IN (
SELECT word
FROM `bigquery-public-data`.samples.shakespeare
);
推荐阅读
- shopware - 商店用品中产品组的最佳实践
- scheme - 如何使用带有哈希表的 ice-9 原子盒
- kubernetes - Kubernetes 命名空间 post 和 pre delete 钩子
- python - 使用 Matplotlib 的条形图绘制烛台和成交量图并跳过周末
- c# - 创建 TXT 文件并将其保存到 DISK C:使用 system.io ,但访问被拒绝
- xcode - macOS 应用程序不能分发“开发者 ID”(选项不显示)
- python - python 如何在没有 CMD 'echo %SystemRoot%' 的情况下获得 %SystemRoot%?
- javascript - querySelector 有效,但 querySelectorAll 无效
- php - AJAX-如何查询特定表行
- android-camera2 - Camera2 API 在 OnePlus 7 Pro 中不起作用