我知道如何使用%% bq对单个bigquery进行参数化。但是,如何使用该bigquery对%%图表进行参数化?
当我尝试按照此doc /notebooks/datalab/docs/tutorials/BigQuery/BigQuery%20Parameterization.ipynb(在我的datalab实例上)的指导添加参数时 它不起作用
答案 0 :(得分:2)
我能够使用图表对图表中使用的查询进行参数化
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
int main() {
const int NUM_TOKENS = 3;
std::vector<std::vector<std::string>> v(NUM_TOKENS);
int token = 0;
std::string str("Mary:Had:Lamb");
std::istringstream split(str);
std::string line;
while (std::getline (split, line, ':')){
v[token++].push_back(line);
if ( token == NUM_TOKENS )
token = 0;
}
return 0;
}
,这是普通的python。
bq来自query_name = bq.Query(query_string)
。
import google.datalab.bigquery as bq
使用query_name中的查询。