Making API call as part of UDF in BigQuery - possible?

南楼画角 提交于 2019-12-06 02:50:53

问题


I'm wondering if it would be possible to make a api call to the google maps geocoding api within a UDF in BigQuery?

I have Google analytics geo fields such as

{
"geoNetwork_continent": "Europe",
"geoNetwork_subContinent": "Eastern Europe",
"geoNetwork_country": "Russia",
"geoNetwork_region": "Novosibirsk Oblast",
"geoNetwork_metro": "(not set)"
},

And would like to make calls to:

https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=XXXX

Just wondering if i'd be able to use javascript within the UDF to make an api call for each row in BigQuery.

Would be very powerful and avoid me having to do it in R or Python.

Very much a novice on UDF's so just wanted to ask to see if what i'm suggesting is even possible or not (wondering if external api calls in UDF might be some sort of security concern for whatever reason or if just technically not possible).

Any advice much appreciated.


回答1:


Making network calls from your UDF is not permitted. This is due to both security considerations, as well as the fact that queries are (heavily) sharded for execution in BigQuery. Making per-record outbound network connections from the query nodes would DDOS many targets ;)




回答2:


I think, currently, API calls within UDF are subject of BigQuery UDF limitations
https://cloud.google.com/bigquery/user-defined-functions#limitations



来源:https://stackoverflow.com/questions/34633292/making-api-call-as-part-of-udf-in-bigquery-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!