bigquery-ai-ml

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

1|Updated Aug 30, 2026
One-click install
npx skills add https://github.com/FeexSystems/3WM-SONIK-LABS --skill bigquery-ai-ml-feexsystems
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: bigquery-ai-ml
Source: https://github.com/FeexSystems/3WM-SONIK-LABS/tree/main/.gemini/skills/bigquery-ai-ml
Command: npx skills add https://github.com/FeexSystems/3WM-SONIK-LABS --skill bigquery-ai-ml-feexsystems

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Analysts often need machine learning and generative AI capabilities like forecasting, anomaly detection, and text classification without leaving their SQL environment or managing separate ML infrastructure. This Skill provides the syntax, constraints, and best practices for BigQuery's built-in AI and ML functions. ## 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: Use AI.GENERATE, AI.GENERATE_TABLE, AI.CLASSIFY, AI.IF, and AI.SCORE to summarize, classify, filter, and rank data with Gemini models directly in queries. - Semantic Search & Embeddings: Create embeddings with AI.GENERATE_EMBEDDING and run similarity searches with VECTOR_SEARCH and AI.SEARCH. - Use Case: A data analyst wants to forecast next month's sales per store and flag unusual revenue days. The Skill guides writing AI.FORECAST with id_cols for per-store series and AI.DETECT_ANOMALIES with a probability threshold, following mandatory syntax rules like placing TVFs in the FROM clause. ## Quick Start Ask the AI 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 SQL?▼

Use AI.FORECAST, a table-valued function powered by the pre-trained TimesFM model, placed in the FROM clause. Provide your historical table or query, data_col, and timestamp_col, and optionally set horizon, id_cols for multiple series, and confidence_level.

How do I use generative AI inside BigQuery queries?▼

Use AI.GENERATE for free-form text generation or AI.GENERATE_TABLE for structured extraction into a defined output schema. Both call Gemini models through a remote model connection, and AI.GENERATE_TABLE requires an input column aliased as prompt.

What is the difference between AI.KEY_DRIVERS and contribution analysis models?▼

AI.KEY_DRIVERS is a table-valued function that identifies segments driving metric changes without creating a model. Contribution analysis requires a CREATE MODEL statement with MODEL_TYPE 'CONTRIBUTION_ANALYSIS' and results are retrieved via ML.GET_INSIGHTS.

Does BigQuery anomaly detection require training a custom model?▼

No. AI.DETECT_ANOMALIES uses the pre-trained TimesFM model, so you only supply historical data, target data, and the data and timestamp columns. You can tune sensitivity with anomaly_prob_threshold, which defaults to 0.95.

Why does my AI.GENERATE_TABLE query fail with a syntax error?▼

Common causes include placing the table-valued function outside the FROM clause, missing the required prompt column alias in the input subquery, or leaving the output_schema string unquoted. Verify these three constraints first.

Can I do semantic search on BigQuery tables without embeddings?▼

AI.SEARCH works on tables with autonomous embedding generation enabled via a generated AI.EMBED column. Otherwise, generate embeddings with AI.GENERATE_EMBEDDING and use VECTOR_SEARCH with a distance type such as COSINE.