我在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不支持声明值,因此while
和declare
在这里几乎毫无用处。我有什么办法可以使用自定义函数在有无循环的情况下在bigquery中插入海量数据?