databricks-dbsql

Generates and explains Databricks SQL features including scripting, AI functions, and geospatial queries.

4|1|Updated May 22, 2026
One-click install
npx skills add https://github.com/ThomazRossito/ai-data-agents --skill databricks-dbsql-thomazrossito
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: databricks-dbsql
Source: https://github.com/ThomazRossito/ai-data-agents/tree/main/plugins/ai-data-agents/skills/databricks-dbsql
Command: npx skills add https://github.com/ThomazRossito/ai-data-agents --skill databricks-dbsql-thomazrossito

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct SQL for Databricks SQL warehouses requires knowing which features exist, their exact syntax, and which runtime versions support them. This Skill provides accurate syntax patterns and reference documentation for DBSQL capabilities so queries work the first time. ## Core Features & Use Cases - Procedural SQL and Scripting: Write SQL scripting blocks, stored procedures with error handling, recursive CTEs, and multi-statement transactions. - AI and Federation Functions: Use ai_query, ai_classify, ai_extract, ai_forecast, vector_search, http_request, remote_query, and read_files with full parameter references. - Geospatial and Collation Support: Apply 39 H3 functions, 80+ ST spatial functions, and ICU collations for proximity search and case-insensitive matching. - Use Case: A data engineer needs to classify support tickets with ai_classify, schedule a materialized view refresh, and run an H3-based proximity join, all with correct syntax and warehouse requirements. ## Quick Start Use the databricks-dbsql skill to write a stored procedure that merges staging data into a dimension table with error handling.

Frequently Asked Questions about databricks-dbsql

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

FAQPage Schema
How do I create a stored procedure in Databricks SQL?▼

Use CREATE OR REPLACE PROCEDURE with LANGUAGE SQL, available in Databricks Runtime 17.0+. Define IN/OUT parameters, wrap logic in BEGIN...END, add DECLARE EXIT HANDLER for error handling, and invoke it with CALL.

How to use ai_query and ai_classify in Databricks SQL?▼

Call ai_query with an endpoint name and prompt, optionally setting returnType, modelParameters, and responseFormat for structured output. ai_classify takes content and an array of 2-20 labels. Both require a serverless SQL warehouse.

Does Databricks SQL support materialized views?▼

Yes, CREATE MATERIALIZED VIEW is supported on Pro and Serverless SQL warehouses. You can add CLUSTER BY for Liquid Clustering and SCHEDULE EVERY for automatic refreshes, such as hourly incremental updates.

What is the difference between H3 and ST functions in Databricks?▼

H3 functions index locations into hexagonal grid cells for fast pre-filtering and aggregation, available since DBR 11.2. ST functions perform precise spatial operations like ST_Contains and ST_Distance on GEOMETRY and GEOGRAPHY types, requiring DBR 17.1+.

Can Databricks SQL query external databases like PostgreSQL?▼

Yes, the remote_query table-valued function runs read-only queries against PostgreSQL, MySQL, SQL Server, Oracle, Snowflake, BigQuery, and others via Lakehouse Federation connections. It requires Unity Catalog and DBR 17.3+ or SQL Warehouse 2025.35+.

Why do AI functions fail on Databricks SQL Classic warehouses?▼

AI functions are not available on SQL Classic; they require a serverless SQL warehouse in a region supporting batch inference. Use LIMIT during development to control token costs and Foundation Model API rate limits.