Databricks SQL (DBSQL) - Advanced Features
Quick Reference
Common Patterns
SQL Scripting - Procedural ETL
Stored Procedure with Error Handling
Materialized View with Scheduled Refresh
Pipe Syntax - Readable Transformations
AI Functions - Enrich Data with LLMs
Geospatial - Proximity Search with H3
Collation - Case-Insensitive Search
http_request - Call External APIs
read_files - Ingest Raw Files
Recursive CTE - Hierarchy Traversal
remote_query - Federated Queries
Reference Files
Load these for detailed syntax, full parameter lists, and advanced patterns:
Key Guidelines
- Always use Serverless SQL warehouses for AI functions, MVs, and http_request
- Use
LIMITduring development with AI functions to control costs - Prefer Liquid Clustering over partitioning for new tables (1-4 keys max)
- Use
CLUSTER BY AUTOwhen unsure about clustering keys - Star schema in Gold layer for BI; OBT acceptable in Silver
- Define PK/FK constraints on dimensional models for query optimization
- Use
COLLATE UTF8_LCASEfor user-facing string columns that need case-insensitive search - Test SQL via CLI (
databricks experimental aitools tools query) or notebooks before deploying. If--warehouseis rejected on your CLI version, setDATABRICKS_WAREHOUSE_IDin the environment instead.

