Is it possible to make an API call as part of UDF in BigQuery?

I am wondering if it is possible to make an api call to geocode google maps api in UDF in BigQuery?

I have google analytics geological fields like

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

And I would like to call:

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

Just wondering if I can use javascript inside UDF to make an api call for every row in BigQuery.

It would be very strong and not allow me to do this in R or Python.

Very new to UDF, so I just wanted to ask if what I am proposing is possible or not (I wonder if the external api calls in UDF will be some kind of security issue for any reason or if it’s not technically possible).

Any advice is greatly appreciated.

+5
source share
2 answers

Making network calls from your UDF is not allowed. This is due to both security concerns and the fact that queries (to a large extent) are sent for execution in BigQuery. To create outgoing network outgoing calls from request nodes there would be many DDOS goals;)

+7
source

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

+1
source

Source: https://habr.com/ru/post/1239993/


All Articles