databricks-dbsql

Document advanced Databricks SQL patterns for procedural SQL, stored procedures, and governance.

1|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/leary-poken/ai-dev-kit --skill databricks-dbsql-leary-poken
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: databricks-dbsql
Source: https://github.com/leary-poken/ai-dev-kit/tree/main/databricks-skills/databricks-dbsql
Command: npx skills add https://github.com/leary-poken/ai-dev-kit --skill databricks-dbsql-leary-poken

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Databricks SQL (DBSQL) is a powerful, but complex, ecosystem. This skill consolidates advanced DBSQL patterns, best practices, and reference implementations to accelerate developer productivity and ensure governance.

Core Features & Use Cases

  • Procedural SQL patterns: BEGIN...END blocks, DECLARE, SIGNAL for error handling, and multi-statement transactions
  • Stored procedures, recursive CTEs, and multi-statement transactions
  • Materialized views, liquid clustering, and Unity Catalog governance
  • Lakehouse Federation and remote_query usage patterns for external data sources

Quick Start

Run the included DBSQL examples in a Databricks workspace to observe procedural SQL, MV refresh, and Lakehouse integration patterns in action.

Frequently Asked Questions about databricks-dbsql

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

FAQPage Schema
How do I write stored procedures and procedural SQL in Databricks SQL?

Databricks SQL supports procedural SQL patterns including BEGIN...END blocks, DECLARE, and SIGNAL for error handling. You can write stored procedures, execute multi-statement transactions, and use these constructs to build complex procedural logic directly in your DBSQL scripts.

What is a recursive CTE and how does it work in Databricks?

A recursive CTE in Databricks allows you to query hierarchical or graph-structured data by repeatedly executing a self-referencing subquery. This advanced SQL pattern is fully supported in DBSQL for traversing parent-child relationships and iterative data processing.

How do I manage materialized views and liquid clustering in DBSQL?

DBSQL provides comprehensive patterns for materialized view refresh and liquid clustering to optimize query performance. Liquid clustering dynamically adapts data layout without requiring manual maintenance, while materialized views precompute results for faster analytical querying.

Can I use Lakehouse Federation to query external data sources with Databricks SQL?

Yes, Databricks SQL supports Lakehouse Federation and remote_query usage patterns to query external data sources directly. This allows you to integrate and analyze external data without needing to move or copy it into your Databricks workspace.

How do I apply Unity Catalog governance to my Databricks SQL scripts?

Unity Catalog governance in DBSQL provides centralized access control and data lineage for your SQL scripts. You apply it by registering tables and views within the catalog, ensuring that procedural SQL, materialized views, and stored procedures comply with unified governance policies.