如何使用用户定义的函数在BigQuery数据集中插入多行?

时间:2019-04-07 04:03:45

标签: arrays loops google-bigquery

我在javascript上编写了一个函数,并将其部署到Google Cloud。基本上是一个随机字符串生成器

CREATE TEMPORARY FUNCTION myUDF()
  RETURNS STRING
  LANGUAGE js AS
"""
    return randomString(12);
"""
OPTIONS (
  library="gs://kaneki110299/tester.js"
);



INSERT INTO `Lambert.fortune` (password)
Values (myUDF())

此查询将值添加到一个单行和工作。我尝试将post's instruction

这样的查询插入BigQuery数据集的数十亿行中
declare @id int 
select @id = 1
while @id >=1 and @id <= 1000
begin
    insert into student values(@id, 'jack' + convert(varchar(5), @id), 12)
    select @id = @id + 1
end

不幸的是,bigquery不支持声明值,因此whiledeclare在这里几乎毫无用处。我有什么办法可以使用自定义函数在有无循环的情况下在bigquery中插入海量数据?

0 个答案:

没有答案