简体   繁体   English

Google AppScript 大型多行查询字符串 (BigQuery) 问题

[英]Google AppScript large multi-line query string (BigQuery) issue

I have been perplexed by this issue for a long time.我被这个问题困扰了很久。 I work with pretty massive multi-line bigquery sql strings.我使用相当大的多行 bigquery sql 字符串。 When I go to schedule them using Google AppScript, I have to spend hours trying to format them because:当我 go 使用 Google AppScript 安排它们时,我不得不花费数小时尝试格式化它们,因为:

  • They are multi line (~ 1000 lines)它们是多行的(~ 1000 行)
  • And to use them in appscript, I have to convert them in a format like this要在 appscript 中使用它们,我必须将它们转换为这样的格式

    var queryString = " -- MEASUREMENTS AT DAY LEVEL " queryString += "---------------------------------------------------------------------------------------------------------------------------- " queryString += "-- ** All marketing pages and whether logged in or out " queryString += "-- UNION " queryString += "-- All marketing pages irrespective of logged in or out " queryString += "---------------------------------------------------------------------------------------------------------------------------- " queryString += "\n SELECT 'day' as measurement_period,"

( This question has an example appscript that runs a SQL. That SQL has been formatted to be in one line. In my case it will be multi-line) 这个问题有一个运行 SQL 的示例应用脚本。SQL 已被格式化为一行。在我的例子中它将是多行)

Any suggestions how I could possibly avoid this and: 1. Either just copy paste a code block?有什么建议可以避免这种情况,并且: 1. 要么只是复制粘贴一个代码块? 2. Or use a "saved query" from my bigquery account? 2. 或者使用我的 bigquery 帐户中的“保存的查询”?

Thank you!谢谢!

It looks like the backslash is the line continuation character, so if you end each line with a backslash, that should work to make a really long queryString.看起来反斜杠是行继续字符,所以如果您以反斜杠结束每一行,那应该可以生成一个非常长的 queryString。

ie IE

var queryString = "SELECT * FROM Foo;\ var queryString = "SELECT * FROM Foo;\

SELECT * FROM Bar" SELECT * 来自酒吧”

There's probably some limit to how long the queryString can be, but I don't know what that is. queryString 的长度可能有一些限制,但我不知道那是什么。

Seems like there should be a way to use a saved query, but I have not found it.似乎应该有一种方法可以使用已保存的查询,但我还没有找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将多行查询粘贴到 BigQuery SQL shell - Pasting multi-line queries into BigQuery SQL shell Google AppScript BigQuery API 调用认证 - Google AppScript BigQuery API call authentication 通过 Google BigQuery 中的 SQL 查询排除以某个字母开头的字符串 - Exclude a string starting with certain letter by a SQL query in Google BigQuery 在 bigquery 中拆分字符串的问题 - Issue with splitting string in bigquery BigQuery 和 Google Analytics SQL 查询 - BigQuery and Google Analytics SQL query Python 中的 Google BigQuery 查询在使用 result() 时有效,但在使用 to_dataframe() 时出现权限问题 - Google BigQuery query in Python works when using result(), but Permission issue when using to_dataframe() EC2 Image Builder yaml 中的多行 bash 脚本 - Multi-line bash script in yaml for EC2 Image Builder 查询执行期间超出了 Google BigQuery 资源。 如何在 SQL 中拆分带有分区的大 window 帧 - Google BigQuery Resources exceeded during query execution. How to split large window frames with partition in SQL 如何在 Google AppScript 中获取 BigQuery 数据集中的表列表 - How do I get the list of tables in my BigQuery dataset in a Google AppScript 相当于谷歌bigquery中包含的字符串 - Equivalent of string contains in google bigquery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM