google-bigquery - 我如何使用新的 UDF 功能来创建 "Dynamic SQL statement"?

标签 google-bigquery

如何使用新的 UDF 功能来创建“动态 SQL 语句”? 有没有办法使用 UDF 来构造基于模板和输入变量的 SQL 语句,然后运行此查询?

最佳答案

文档 https://cloud.google.com/bigquery/user-defined-functions?hl=en说:

A UDF is similar to the "Map" function in a MapReduce: it takes a single row as input and produces zero or more rows as output. The output can potentially have a different schema than the input.

因此您的 UDF 仅接收一行。 因此 - 不,UDF 不适用于您在问题中描述的目的。

您可能会看一下 View - 也许这更适合您: https://cloud.google.com/bigquery/querying-data#views

关于google-bigquery - 我如何使用新的 UDF 功能来创建 "Dynamic SQL statement"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32421890/

相关文章:

sql - 大查询 : Divided by sum of values in column to find the ratio

google-bigquery - 如何将非分区表转换为分区表

google-bigquery - 从文本文件运行查询

google-bigquery - 从 Google Cloud Storage 提供 Google 客户服务帐户的 keyFilename

json - 在 BigQuery 中存储 JSON

database - BigQuery - 获取 1000000 条记录并使用 goLang 对数据进行一些处理

python - 在 Beam 管道中以编程方式生成 BigQuery 架构

date - 谷歌大查询 : Select and group by "yyyy-mm" from date field ("yyyy-mm-dd") or timestamp

sql - 使用 BigQuery 中的事件时间戳检测事件之间的 30 天(或更长)间隔

Python BigQuery allowLargeResults 与 pandas.io.gbq