Sunday , November 29 2026
Use Google Cloud for ML: Vertex AI, Gemini on Vertex, BigQuery from Python, BigQuery ML and Cloud Run deployment.

Google Cloud AI: Vertex AI, BigQuery ML and Cloud Run

Updated: 28 November 2026Level: IntermediateReading time: about 10 minutesgoogle-cloud-aiplatform · google-genai

Google Cloud offers Vertex AI, a single platform to train, deploy and monitor ML models and to use Google’s Gemini models and other foundation models. It also has BigQuery, one of the best tools for analysing very large datasets with SQL.

What You Will Learn

  • The main Google Cloud AI services
  • Query big data with BigQuery from Python
  • Use Gemini through Vertex AI
  • Train with BigQuery ML using only SQL
  • Deploy a container with Cloud Run

Prerequisites

Google Gemini and SQL Basics.

Key Services

Service Used for
Vertex AI Training, model registry, endpoints, pipelines, Gemini and Model Garden
BigQuery Serverless data warehouse; BigQuery ML trains models with SQL
Cloud Storage Files, datasets and models
Cloud Run Run any Docker container as a scalable web service
GKE Managed Kubernetes
Document AI, Vision, Speech Ready-made AI APIs

Setup

Example
# install the gcloud CLI, then:
gcloud auth application-default login
gcloud config set project my-project-id
pip install google-cloud-bigquery google-genai db-dtypes

1. BigQuery from Python

Example
from google.cloud import bigquery
client = bigquery.Client()
sql = """
SELECT name, SUM(number) AS total
FROM `bigquery-public-data.usa_names.usa_1910_2013`
WHERE gender = 'F'
GROUP BY name ORDER BY total DESC LIMIT 5
"""
df = client.query(sql).to_dataframe()
print(df)

Explanation: BigQuery runs the SQL on Google’s servers and returns a pandas DataFrame. Public datasets are free to explore within the free monthly query quota.

2. Gemini on Vertex AI

Example
from google import genai
client = genai.Client(vertexai=True, project="my-project-id", location="us-central1")
resp = client.models.generate_content(model="gemini-2.5-flash",
                                      contents="Give 3 uses of AI in agriculture.")
print(resp.text)

Explanation: The same google-genai SDK from the Gemini tutorial works with Vertex AI by setting vertexai=True, which adds enterprise controls, data residency and billing through your Cloud project.

3. BigQuery ML: Train with SQL

Example
CREATE OR REPLACE MODEL `mydataset.churn_model`
OPTIONS(model_type='logistic_reg', input_label_cols=['churned']) AS
SELECT tenure, monthly_charges, contract_type, churned FROM `mydataset.customers`;

SELECT * FROM ML.EVALUATE(MODEL `mydataset.churn_model`);
SELECT * FROM ML.PREDICT(MODEL `mydataset.churn_model`, TABLE `mydataset.new_customers`);

Explanation: Analysts can build, evaluate and use models without leaving SQL. BigQuery ML supports regression, classification, k-means, time-series forecasting and more.

4. Deploy a Container with Cloud Run

Example
gcloud run deploy iris-api --source . --region asia-south1 --allow-unauthenticated

Explanation: Cloud Run builds the Docker image from your folder, deploys it and gives you an HTTPS URL. It scales to zero when idle, so you pay only for requests. asia-south1 is the Mumbai region.

Note: Cloud services, names and prices change often, and running resources cost money. Check the provider’s current documentation and pricing, use the free tier where possible, and always delete endpoints and clusters you no longer need.

Common Errors

Problem Cause and fix
DefaultCredentialsError Run gcloud auth application-default login.
API not enabled Enable the API (BigQuery, Vertex AI, Cloud Run) for your project in the console.
Large BigQuery bill Select only needed columns, filter partitions and check the bytes estimate before running.

Series

MLOps series: ML Deployment · Flask & FastAPI · Docker · Kubernetes · MLflow · CI/CD for ML · AWS for ML · Google Cloud AI

Interview Questions

Q: What is BigQuery ML?
A BigQuery feature for creating and running ML models using SQL statements.

Q: Cloud Run vs GKE?
Cloud Run runs containers with no cluster management; GKE gives full Kubernetes control.

Practice Exercises

  1. Query a BigQuery public dataset and plot the result.
  2. Deploy your FastAPI model to Cloud Run.

Summary

Google Cloud gives you Vertex AI for models and Gemini, BigQuery for big-data SQL and BigQuery ML, and Cloud Run for simple container deployment.

Next: ML Deployment · Data Engineering

About Machine Learning

Check Also

MLflow Tutorial: Experiment Tracking and Model Registry

Track ML experiments with MLflow: parameters, metrics, models, autologging, model registry and serving.