bigquery-ai-ml

Write BigQuery SQL queries using built-in AI and ML functions for forecasting, anomaly detection, and generative analysis.

Updated Aug 16, 2026
One-click install
npx skills add https://github.com/1919114514yasenpai-maker/focus-quest --skill bigquery-ai-ml-1919114514yasenpai-maker
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: bigquery-ai-ml
Source: https://github.com/1919114514yasenpai-maker/focus-quest/tree/main/.gemini/skills/bigquery-ai-ml
Command: npx skills add https://github.com/1919114514yasenpai-maker/focus-quest --skill bigquery-ai-ml-1919114514yasenpai-maker

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct BigQuery AI/ML SQL requires knowing the exact syntax, argument rules, and routing constraints of functions like AI.FORECAST, AI.GENERATE, and AI.KEY_DRIVERS, which are easy to misuse without authoritative references. ## Core Features & Use Cases - Time-Series Analysis: Generate forecasts with AI.FORECAST, detect anomalies with AI.DETECT_ANOMALIES, and evaluate model accuracy with AI.EVALUATE using the pre-trained TimesFM model. - Generative AI in SQL: Classify, summarize, score, and generate text or structured output directly in queries using AI.GENERATE, AI.CLASSIFY, AI.AGG, AI.IF, and AI.GENERATE_TABLE with Gemini endpoints. - Semantic Search & Key Drivers: Perform vector and semantic search with VECTOR_SEARCH and AI.SEARCH, and identify metric drivers with AI.KEY_DRIVERS or contribution analysis models. - Use Case: A data analyst needs to forecast next month's sales per store and explain which dimensions drove a revenue change; this Skill provides the exact SQL patterns and mandatory best-practice rules to do both correctly. ## Quick Start Ask the assistant to write a BigQuery SQL query that forecasts daily sales for the next 30 days using AI.FORECAST on your sales table.

Frequently Asked Questions about bigquery-ai-ml

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I forecast time series data in BigQuery without training a model?▼

Use the AI.FORECAST table-valued function, which relies on the pre-trained TimesFM model. Provide your historical table or query, specify data_col and timestamp_col, and optionally set horizon, id_cols for multiple series, and confidence_level.

How do I detect anomalies in BigQuery time series data?▼

Use AI.DETECT_ANOMALIES with a historical dataset and a target dataset, specifying data_col and timestamp_col. It uses TimesFM to flag points where anomaly probability exceeds the threshold, which defaults to 0.95.

What is the difference between AI.GENERATE and AI.GENERATE_TABLE in BigQuery?▼

AI.GENERATE is a scalar function returning a STRUCT with generated content per row, while AI.GENERATE_TABLE is a table-valued function called in the FROM clause that extracts information into a typed output schema and preserves all input columns.

Does BigQuery AI.FORECAST require creating a model first?▼

No, AI.FORECAST uses the pre-trained TimesFM foundation model directly, so no CREATE MODEL statement is needed. However, generative functions like AI.GENERATE_TABLE and AI.GENERATE_EMBEDDING require a remote model created with a connection to a Vertex AI endpoint.

Why must AI.FORECAST and AI.GENERATE_TABLE be placed in the FROM clause?▼

They are table-valued functions that return tables rather than scalar values, so BigQuery syntax requires them in the FROM clause. Optional arguments for AI.FORECAST and AI.EVALUATE must also use the named argument => operator.

When should I use AI.KEY_DRIVERS versus a contribution analysis model?▼

AI.KEY_DRIVERS is a table-valued function that identifies key drivers directly on a table without creating a model. Contribution analysis requires creating a CONTRIBUTION_ANALYSIS model with CREATE MODEL and retrieving results via ML.GET_INSIGHTS.