4. Meet Dataform: SQL pipelines made tidy
4.1 What is Dataform, and why do teams use it?
Highlights & notes
Select lesson text to highlight it, or tap Add note.
Bookmarks
Bookmark a lesson to see it here.
You can already build bronze, silver and gold tables with SQL. But a real project has hundreds of queries. Which one runs first? Who changed what? Was the data tested? A folder of loose .sql files cannot answer these questions.
Dataform is Google Cloud's tool for the T in ELT: Extract, Load, Transform. The data is already loaded into BigQuery. Dataform turns it into clean, tested tables.
- You write each table as a small file of SQL
- Dataform works out the right order to run the files
- It tests the data, and keeps every change in Git
Dataform itself is free. It does not store or move data. It sends SQL to BigQuery, and you pay only for the BigQuery queries it runs.
Loose SQL files vs Dataform
- Table names typed by hand →
ref()links the tables for you - You remember the run order → Dataform builds the order from the links
- No tests → assertions check the data on every run
- A file called final_v2_new.sql → a clean history in Git
Dataform only transforms data that is already inside BigQuery. It does not load files. Loading happens before Dataform, for example with a load job or an Airflow task.
How it fits together
- Raw tables in BigQuery
- Dataform: SQL files + tests
- Clean tables in BigQuery
From a small file to a real table
This file is saved as definitions/orders_clean.sqlx. You write the short file. Dataform writes the long SQL.
SQLX
config { type: "table" }SELECT order_id, amountFROM ${ref("orders_raw")}WHERE amount IS NOT NULL
Result
CREATE OR REPLACE TABLE `shop-dev.dataform.orders_clean` AS SELECT order_id, amount FROM `shop-raw.bronze.orders_raw` WHERE amount IS NOT NULL
Try it yourself
1. In the Google Cloud console, search for Dataform and open it. Dataform needs a project with billing turned on. Small practice runs stay inside BigQuery's free monthly allowance.
2. Click Create repository. Name it learn-dataform, pick a region and a service account.
3. Open the repository and click Create development workspace. Name it after yourself.
Question 1 · Easy
Which letter of ELT does Dataform handle?
Question 2 · Medium
What does Dataform send to BigQuery?
Question 3 · Hard
A project has 200 SQL files. How does Dataform know which table to build first?
Key takeaways
Dataform is the transform step on BigQuery. You write small SQL files, and Dataform orders them, tests the data and keeps the code in Git. It is free; you pay for the BigQuery queries.
Save your progress
Start free and your progress, code and notes stay saved. Free for 1 month, no card needed.
Start free Log in