Skip to main content
BRILLIQS

BigQuery ML

A capability that trains and applies machine learning models using SQL statements inside a data warehouse.

BigQuery ML lets machine learning models be created and used with SQL inside Google BigQuery. A model is created with a statement naming the model type and the query supplying the training data, and predictions are produced by another statement. The data does not leave the warehouse to be trained on.

The step this removes

A conventional machine learning project on warehouse data begins with an export.

Data is queried out, written to files, moved to an environment with the right libraries, loaded into memory and only then trained on. Afterwards the model exists somewhere else, and applying it to warehouse data means moving data again.

That movement is frequently the slowest part of the project, and it is often the part that raises questions about where data is allowed to go.

BigQuery ML removes it. The model is trained where the data already sits.

Models created with SQL

A model is created with a statement. You name the model type and supply a query that returns the training data.

Prediction is another statement. It returns predictions alongside the input rows, so the result is a table like any other.

That has an immediate consequence: predictions can be joined to other warehouse tables in the same query. A prediction next to the customer record and their order history is one statement rather than an integration.

Who this opens machine learning to

The audience is people who already write SQL against the warehouse.

That is a large group, and conventionally they cannot train a model without learning a framework, a language and an environment. Each of those is a real obstacle, and together they are usually enough to prevent the attempt.

Expressing the model in SQL removes all three. An analyst who can write a query can train a model on data they already understand, which is frequently a bigger advantage than any technical property of the model.

What it is well suited to

The strongest use is establishing whether a signal exists.

Before committing to a machine learning project, the question is whether the data supports the prediction at all. Answering that conventionally takes an export, an environment and several days.

Answering it in SQL takes an afternoon. If the result is promising, a proper project is justified. If it is not, a great deal of effort has been saved.

The model types

The documented types cover common tasks: classification, regression, clustering, forecasting and others.

These are the shapes most business prediction problems take, and the documentation lists what is available along with the options for each.

Who uses it

BigQuery ML is used by analysts and data teams working in BigQuery, particularly where the data already lives there and the alternative involves exporting it.

Points to consider

It is specific to BigQuery, so it applies where that is your warehouse.

Model types are those provided. Work needing custom architecture or unusual preprocessing belongs in a dedicated framework, and the documentation is clear about what is covered.

Cost is warehouse compute. Training consumes it, prediction consumes it, and repeated training on large tables consumes a good deal of it. The pricing documentation is the reference, and understanding it before scheduling frequent retraining is sensible.

Getting started

The documentation includes an introduction and a first example that creates a model from a query and produces predictions, followed by a page per model type. Training one model on an existing table demonstrates the whole approach in a few statements.

Key features of BigQuery ML

Capabilities described in the official documentation.

Models created with SQL

A statement names the model type and supplies training data as a query, and the model is built from it.

Training where the data already is

Because training runs in the warehouse, data is not exported to a separate environment first.

Several model types

The documented types cover classification, regression, clustering, forecasting and other common tasks.

Prediction as a query

Applying a model is a statement returning predictions alongside the input rows.

Advantages of BigQuery ML

Factual advantages that follow from the features above.

No data movement

Training without exporting removes a step that is often the slowest and most sensitive part of a project.

Analysts can build models

Because the interface is SQL, people who query the warehouse can train a model without a new language.

Predictions join to other data

Since prediction is a query, results combine with warehouse tables in the same statement.

Scoring can be scheduled like a query

Applying a model on a schedule uses the same mechanisms as any other scheduled warehouse query.

Common use cases for BigQuery ML

Situations the official documentation describes this tool as being used for.

Retail

Predicting from warehouse tables

A model is trained on existing tables and applied to produce predictions without leaving the warehouse.

Cross industry

Establishing whether a signal exists

A model is trained quickly in SQL to see whether the data supports a prediction before further investment.

Marketing

Grouping records without labels

A clustering model finds segments within warehouse data for analysis or targeting.

Operations

Scheduled scoring of a table

A scheduled query applies a model and writes predictions into a table for downstream use.

Official website

Everything on this page is based on the official documentation for BigQuery ML. You can read the source here.

BigQuery ML official documentation

Frequently asked questions about BigQuery ML

Answers taken from the official documentation for this tool.

No. Training and prediction happen inside the warehouse, so there is no export to a separate environment. That removes a step which is frequently both slow and sensitive.

When the model needs custom architecture, unusual preprocessing or fine control over training. The documented model types cover common tasks well, and work outside them belongs in a framework built for it.

People who already query the warehouse. Because models are created and applied with SQL, an analyst can train one without learning a machine learning framework or moving into another environment.

Training and prediction consume warehouse compute, billed as warehouse usage. That is worth understanding before training repeatedly on large tables, and the pricing documentation sets out how it is measured.