In a previous post, I mentioned Remote Functions—a powerful way to send data from BigQuery to an external service for processing, including a Cloud Run function.
This is especially useful when SQL lacks built-in support for your specific needs, and writing a UDF isn’t an option (for example, if you need a highly specialized Python function).
Before building your own, check out bigfunctions—many common use cases have already been solved by others!
What are remote functions in BigQuery?
These are a special type of function that delegates processing of input to an external resource, allowing us to:
send data from BigQuery to Google Cloud Functions or other external services
process it using a programming language
return results to our query
Why is that important?
A Google Remote function can encapsulate any kind of logic in major programming languages.
This opens the door to vast a ecosystem of libraries such at the Python packages.
Let’s look at a step-by-step example of creating a Remote Function.
Step 1: Create the Cloud Run Function
Step 2: Create a connection
Step 3: Set up permissions
Step 4: Bind the connection with Cloud Run function
Test run
Found it useful? Subscribe to my Analytics newsletter at notjustsql.com.