使用Google BigQuery紧接着运行多个查询 [英] Using Google BigQuery to run multiple queries back to back

查看:144
本文介绍了使用Google BigQuery紧接着运行多个查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Google Big Query从电子表格中提取数据。我很新的SQL,所以我很抱歉。我目前使用下面的代码:

 选择* 
从my_data
where T1> 1000
并且T2> 2000

因此,保持Select和From相同,我希望能够运行多个查询,可以不断改变我在 t1 t2 之间寻找的值。大约有50个不同的值。我希望BigQuery能够连续运行这50个不同的值。有没有办法做到这一点?

解决方案


我非常新到SQL


...并且我假设BigQuery是...,所以

以下是使用


注意<$ c $这些是由BigQuery Mate识别的参数。< var_t1> 和< var_t2>


  1. 现在您可以设置这些参数

    点击 QB Mate 和然后参数即可到达


  2. 现在您可以使用设置参数无论您想要运行什么值;

    单击替换参数确定按钮,这些值将出现在编辑器中。例如




在点击 OK 后,您将获得

p>

所以现在你可以运行你的查询了


  1. 运行另一个点击编辑查询按钮



现在重复设置参数等等



您可以找到BigQuery Mate Chrome扩展程序
此处



免责声明:我是该工具的唯一开发者


I'm currently working a project where I'm using Google Big Query to pull data from spreadsheets. I'm VERY new to SQL, so I apologize. I'm currently using the following code

Select *
From my_data
Where T1 > 1000
And T2 > 2000

So keeping the Select and From the same, I want to be able to run multiple queries where I can just keep changing the values I'm looking for between t1 and t2. Around 50 different values. I'd like for BigQuery to run through these 50 different values back to back. Is there a way to do this? Thanks!

解决方案

I'm VERY new to SQL

... and I assume to BigQuery either ..., so

Below is one of the options for new users who are not familiar yet with BigQuery API and/or different clients rather than BigQuery Web UI.

BigQuery Mate adds parameters feature to BigQuery Web UI

What you need to do is

  1. Save you query as below using Save Query Button

Notice <var_t1> and <var_t2>
Those are the parameters identifyable by BigQuery Mate

  1. Now you can set those parameters
    Click QB Mate and then Parameters to get to below form

  2. Now you can set parameters with whatever values you want to run with;
    Click on Replace Parameters OK Button and those values will appear in Editor. For example

After OK is clicked you get

So now you can run your query

  1. To Run another round with new parameters, you need to load again your saved query to the editor by clicking on Edit Query Button

and now repeat settings parameters and so on

You can find BigQuery Mate Chrome extension here

Disclaimer: I am the author an the only developer of this tool

这篇关于使用Google BigQuery紧接着运行多个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆