Glossary · Pipelines and tooling
What is dataform?
Dataform is Google Cloud's service for building SQL workflows in BigQuery: you define tables, views, incremental tables and assertions in SQLX files, and Dataform compiles them into a dependency graph and runs them in BigQuery. The service is free; you pay for the BigQuery queries it runs.
How Dataform works
A Dataform repository holds SQLX files: SQL with a config block and JavaScript templating. Each file defines an action, such as a table, view, incremental table, assertion, source declaration or custom SQL operation. References like ${ref("stg_orders")} declare dependencies, and Dataform compiles the repository into SQL and a dependency graph you can inspect before running anything.
Development happens in workspaces, which are editable copies of a Git repository; repositories can connect to GitHub, GitLab, Azure DevOps Services, Bitbucket or Secure Source Manager. Compilation is hermetic and doesn't connect to BigQuery, so it doesn't check GoogleSQL; SQL errors surface when a query is previewed or run.
An incremental table with assertions
config {
type: "incremental",
uniqueKey: ["order_id"],
bigquery: {
partitionBy: "DATE(updated_at)",
clusterBy: ["customer_id"],
labels: { pipeline: "orders" }
},
assertions: {
nonNull: ["order_id", "customer_id"]
}
}
SELECT order_id, customer_id, status, amount, updated_at
FROM ${ref("stg_orders")}
${when(incremental(), `WHERE updated_at > (SELECT MAX(updated_at) FROM ${self()})`)}
With uniqueKey, Dataform merges new rows into the existing table instead of appending, so a rerun doesn't duplicate orders. Setting updatePartitionFilter limits which target partitions the merge scans. The labels go on the table; the nonNull assertion runs as its own query after the table is built and fails if any key is missing.
Cost notes
- Every action is a BigQuery job. Full-refresh tables rebuild everything; incremental tables process new rows only, but the
MERGEstill scans the target unlessupdatePartitionFilterrestricts it. - Assertions cost queries too. Keep them on recent partitions for large tables.
- One workflow configuration per cadence. Running every action hourly because one needs it is a common source of waste; split actions by tags into schedules that match their consumers.
- Attribute cost per action with BigQuery labels and the Dataform service account; see cost attribution.
Dataform vs dbt
Both compile SQL with references into a DAG and build tables in BigQuery. Dataform is built into Google Cloud, free, and uses JavaScript for templating; dbt uses Jinja, runs on many warehouses, and has a larger package ecosystem and its own managed platform.
FAQ
Is Dataform free?
Yes, Dataform is a free service. You pay for the BigQuery queries it runs, for Cloud Logging, and for any scheduler you use to trigger it, such as Managed Service for Apache Airflow, Cloud Scheduler or Workflows.
How do I schedule Dataform runs?
Create a release configuration, which compiles the repository with chosen settings on a schedule, and a workflow configuration, which runs selected actions from that compilation result on a schedule. You can also trigger runs from Airflow or Workflows.
