mssql-to-databricks-migration

Convert T-SQL stored procedures and scripts into Databricks PySpark and Spark SQL notebooks.

1|2|Updated Aug 10, 2026
One-click install
npx skills add https://github.com/TRRaveendra/AI-Agents-Databricks --skill mssql-to-databricks-migration-trraveendra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mssql-to-databricks-migration
Source: https://github.com/TRRaveendra/AI-Agents-Databricks/tree/main/mssql-to-pyspark-ai-agent/skills_mssql_to_sparksql
Command: npx skills add https://github.com/TRRaveendra/AI-Agents-Databricks --skill mssql-to-databricks-migration-trraveendra

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Migrating Microsoft SQL Server workloads to Databricks requires translating T-SQL constructs like stored procedures, cursors, temp tables, and dynamic SQL into Spark equivalents, which is error-prone and time-consuming when done manually. ## Core Features & Use Cases - T-SQL to Spark Translation: Maps DDL, DML, DQL, control flow, functions, and data types from SQL Server to Spark SQL and PySpark using nine detailed reference guides. - Security-First Conversion: Enforces SQL injection prevention rules, safe parameter handling with dbutils.widgets, and Spark-native date functions instead of Python datetime objects. - Pattern-Based Migration: Provides idiomatic rewrites for cursors, SCD Type 2 dimensions, MERGE upserts, SSIS components, and medallion architecture workflows. - Use Case: Given a legacy stored procedure using cursors and temp tables, produce a Databricks notebook with widget parameters, temp views, set-based MERGE operations, and audit logging. ## Quick Start Migrate this T-SQL stored procedure to a Databricks notebook using Spark SQL for data operations and PySpark for control flow.

Frequently Asked Questions about mssql-to-databricks-migration

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

FAQPage Schema
How do I migrate SQL Server stored procedures to Databricks?

Analyze the procedure's parameters, variables, temp tables, and control flow, then map each construct using the reference guides. Use Spark SQL for set-based operations like MERGE and PySpark for orchestration, widgets, and error handling.

How to convert T-SQL cursors to PySpark?

Rewrite cursors as set-based operations such as a single UPDATE or MERGE statement, since row-by-row processing is an anti-pattern in Spark. Use functions like GREATEST to replace conditional per-row updates.

Does Spark SQL support T-SQL MERGE statements?

Yes, Delta Lake supports MERGE with WHEN MATCHED, WHEN NOT MATCHED, and WHEN NOT MATCHED BY SOURCE clauses, making it a near-direct port from T-SQL. T-SQL UPDATE...FROM joins should also be rewritten as MERGE statements.

What is the Spark SQL equivalent of T-SQL temp tables?

Local temp tables (#Temp) map to createOrReplaceTempView for session-scoped views, while global temp tables map to Delta tables in a staging schema. Table variables become temp views or Python collections.

Why is f-string SQL interpolation dangerous in Databricks notebooks?

Interpolating widget values directly into spark.sql strings creates SQL injection vulnerabilities. Use the DataFrame API with col() comparisons, typed DataFrames with temp views, or whitelist-validated identifiers instead.

What T-SQL features cannot be migrated to Databricks directly?

Linked servers, CLR procedures, SQL Mail, Service Broker, full-text search, and SQL Agent jobs have no direct equivalent. They require redesign using JDBC connections, PySpark rewrites, workflow notifications, or streaming patterns.