# Serverless Data Pipelines in GCP using Dataform and BigQuery Remote Functions

DevFeed: [Serverless Data Pipelines in GCP using Dataform and BigQuery Remote Functions](<https://devfeed.tech/articles/serverless-data-pipelines-in-gcp-using-dataform-and-bigquery-remote-functions-23880.md>)

Original publisher: [Read original article](<https://engineering.premise.com/serverless-data-pipelines-in-gcp-using-dataform-and-bigquery-remote-functions-9ee235d0cb18?source=rss----c5fada0a103d---4>)

Author: Austen Novis

Published: 2023-08-23T13:35:22Z

Content type: tutorial

Language: en

Sources: [Engineering at Premise](<https://devfeed.tech/sources/engineering-at-premise-medium.md>)

Topics: [dataform](<https://devfeed.tech/topics/dataform.md>), [Data pipelines](<https://devfeed.tech/topics/data-pipelines.md>), [BigQuery](<https://devfeed.tech/topics/bigquery.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>)

Tags: [bigquery](<https://devfeed.tech/tags/bigquery.md>), [cloud-computing](<https://devfeed.tech/tags/cloud-computing.md>), [cloudrun](<https://devfeed.tech/tags/cloudrun.md>), [custom](<https://devfeed.tech/tags/custom.md>), [data-engineering](<https://devfeed.tech/tags/data-engineering.md>), [data-pipelines](<https://devfeed.tech/tags/data-pipelines.md>), [data-scientists](<https://devfeed.tech/tags/data-scientists.md>), [dataform](<https://devfeed.tech/tags/dataform.md>), [error](<https://devfeed.tech/tags/error.md>), [example](<https://devfeed.tech/tags/example.md>), [external](<https://devfeed.tech/tags/external.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [github](<https://devfeed.tech/tags/github.md>), [gitlab](<https://devfeed.tech/tags/gitlab.md>), [goblet](<https://devfeed.tech/tags/goblet.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [language](<https://devfeed.tech/tags/language.md>), [logic](<https://devfeed.tech/tags/logic.md>), [orchestration](<https://devfeed.tech/tags/orchestration.md>), [permissions](<https://devfeed.tech/tags/permissions.md>), [remote](<https://devfeed.tech/tags/remote.md>), [serverless](<https://devfeed.tech/tags/serverless.md>)

## AI overview

Dataform can orchestrate SQL pipelines in GCP, with GitHub or GitLab integration and failure monitoring, but its limited support for JavaScript constrains custom logic. The example extends it with a BigQuery Remote Function hosted through Goblet: grant the Dataform service account BigQuery read/write access (the article suggests roles/bigquery.user), create a dataset and Dataform workspace, define a Python function, then run `goblet deploy` to provision the Cloud Function, BigQuery connection and routine, and invoker permissions. A downstream Dataform table calls that routine with `val` and `type`; the sample doubles, squares, or zeroes the value. This allows custom code, including possible model calls, to participate in the pipeline. The article presents a specific setup example rather than a comparison with other workflow tools.

## Source excerpt

Photo by Growtika on Unsplash Dataform is an amazing new offering from Google Cloud Platform (GCP) that allows for serverless orchestration for data pipelines. Previously, data engineering pipelines were either supported by separate data engineering teams, which many smaller organizations don't have the resources to support, or were stitched together using a series of interrelated BigQuery scheduled queries, which could be time-consuming to build and error-prone to run and maintain. Dataform solves these problems, especially for data scientists and data analysts, by including features such as Ability to build data pipelines using SQL Integrates with GitHub and GitLab for code versioning and deployment Monitor pipelines for failures and trigger alerts The main limitation of Dataform is that it only supports SQL, with limited ability to add javascript, but this limitation can be overcome with BigQuery Remote Functions. BigQuery Remote Functions allow you to call external services running in Cloudrun or Cloudfunctions from BigQuery, making it possible to have a serverless data pipeline that can run custom logic in any programming language that you may need. The rest of this blog post will go through a complete example on how to setup both Dataform and BigQuery Remote Functions in just a few steps. Setup Dataform We will begin by setting up a simple Dataform pipeline in the GCP console. Navigate to Dataform and create a repository. Create Repository Make sure to grant the default Dataform service account service-PROJECT_ID@gcp-sa-dataform.iam.gserviceaccount.com BigQuery read and write permissions. This can be accomplished using the roles/bigquery.user role. Next create a new development workspace and allow GCP to initialize it, which will add the default files needed to run the pipeline. Dataform files Next create a new BigQuery dataset called tutorial , and inside a table called test with schema id: int, val: int, type: str . BigQuery Schema We can insert some test da