Transitioning from SSIS Packages to Databricks Workflow

Rajesh Vinayagam
5 min readJan 4, 2024


In the realm of data engineering and analytics, the shift from traditional ETL (Extract, Transform, Load) processes like SQL Server Integration Services (SSIS) with stored procedures to more modern, cloud-native solutions like Databricks Workflow is becoming increasingly prevalent. This transition is especially significant when it comes to exporting data from SQL databases into data warehouses. This article explores the advantages of using Databricks Workflow over traditional SSIS packages and stored procedures for such tasks.

Traditional Approach: SSIS and Stored Procedures

Traditionally, SSIS, a component of Microsoft SQL Server, has been a staple in the ETL landscape. It is used for data integration and workflow applications, often coupled with stored procedures for data manipulation. While effective, this approach has limitations, particularly in scalability, flexibility, and cloud compatibility.

The Databricks Workflow Advantage

Databricks Workflow, part of the broader Databricks platform, offers a cloud-native, scalable solution for data integration and ETL processes. Its advantages over SSIS and stored procedures are manifold:


Databricks operates on top of Apache Spark, offering unparalleled scalability. It can handle vast amounts of data far beyond the capacity of traditional SSIS packages. This scalability is crucial for businesses dealing with ever-growing data volumes.

Flexibility and Language Support

Databricks Workflow supports multiple languages like Python, SQL, Scala, and R, providing greater flexibility in data processing and transformation. This contrasts with the more rigid, SQL-centric approach of SSIS and stored procedures.

Cloud-Native Integration

Being a cloud-native platform, Databricks offers seamless integration with various cloud data sources and sinks. This integration is essential for modern data architectures, which are increasingly cloud-based.

Advanced Analytics and Machine Learning

Databricks Workflow is not just an ETL tool; it also integrates advanced analytics and machine learning capabilities. This feature enables more sophisticated data processing workflows, which are not possible with SSIS and stored procedures.

Real-Time Processing

Unlike SSIS, Databricks supports real-time data processing, enabling more timely insights and actions, a critical requirement in today’s fast-paced business environment.

Use Case: Exporting Data from SQL to a Data Warehouse

Consider a typical scenario where a company needs to export data from a SQL database to a data warehouse for analytics. Using Databricks Workflow, this process can be more efficient, scalable, and feature-rich:

  1. Data Extraction: Data is extracted from the SQL database using Spark’s JDBC connectors, allowing for efficient and parallelized data read operations.
  2. Data Transformation: The data can be transformed using Spark’s distributed processing capabilities. Complex transformations that would be cumbersome in stored procedures are more manageable.
  3. Data Loading: The transformed data is loaded into the data warehouse, leveraging Spark’s ability to write data in parallel, significantly speeding up the process.
  4. Real-Time Capabilities: If the business case requires, the workflow can be designed to handle real-time data streams, providing near-instant analytics capabilities.
  5. Advanced Analytics Integration: The workflow can be extended to include advanced analytics and machine learning models, adding more value to the data warehouse.


When migrating from traditional SQL stored procedures to PySpark code for use in Databricks Workflows, understanding how SQL operations translate into PySpark operations is crucial. Below are a few common SQL stored procedure operations and their corresponding PySpark code examples. These examples aim to demonstrate the shift in syntax and approach when moving to PySpark for data processing.

Example 1: Selecting and Filtering Data

SQL Stored Procedure:

FROM Sales
WHERE Quantity > 100 AND Region = 'West';

PySpark Equivalent:

from pyspark.sql import SparkSession

# Initialize Spark Session
spark = SparkSession.builder.appName('SalesData').getOrCreate()

# Read data
sales_df ="source_format").load("path_to_Sales_data")

# Filter data
filtered_sales_df = sales_df.filter((sales_df.Quantity > 100) & (sales_df.Region == 'West'))

# Show results

Example 2: Aggregations (Grouping and Summarizing)

SQL Stored Procedure:

SELECT Region, SUM(Sales) as TotalSales
FROM Sales
GROUP BY Region;

PySpark Equivalent:

from pyspark.sql import SparkSession
from pyspark.sql import functions as F

# Initialize Spark Session
spark = SparkSession.builder.appName('SalesData').getOrCreate()
# Read data
sales_df ="source_format").load("path_to_Sales_data")
# Group and aggregate data
aggregated_sales_df = sales_df.groupBy("Region").agg(F.sum("Sales").alias("TotalSales"))
# Show results

Example 3: Joining Tables

SQL Stored Procedure:

SELECT a.OrderID, a.CustomerName, b.ProductName
FROM Orders a
INNER JOIN Products b ON a.ProductID = b.ProductID;

PySpark Equivalent:

from pyspark.sql import SparkSession
# Initialize Spark Session
spark = SparkSession.builder.appName('JoinExample').getOrCreate()
# Read data
orders_df ="source_format").load("path_to_Orders_data")
products_df ="source_format").load("path_to_Products_data")

# Join data
joined_df = orders_df.join(products_df, orders_df.ProductID == products_df.ProductID, "inner") \
.select(orders_df.OrderID, orders_df.CustomerName, products_df.ProductName)
# Show results

Example 4: Complex Business Logic

SQL Stored Procedure:

Suppose you have a stored procedure that involves multiple steps, including temporary tables, complex joins, and case statements.

CREATE PROCEDURE CalculateTotalSalesByCategory
-- Temp table to hold intermediate results with high selling flag
CREATE TABLE #HighSellingProducts
ProductID INT,
Category VARCHAR(255),
TotalSales DECIMAL(18,2),
HighSeller BIT

-- Join Sales with Products and insert into temp table
INSERT INTO #HighSellingProducts (ProductID, Category, TotalSales, HighSeller)
SUM(s.TotalSales) as TotalSales,
WHEN SUM(s.QuantitySold) > 50 THEN 1
END as HighSeller
Sales s
Products p ON s.ProductID = p.ProductID
p.ProductID, p.Category;

-- Select and aggregate results from temp table for high sellers
SUM(TotalSales) as TotalSales
HighSeller = 1

-- Clean up temp table
DROP TABLE #HighSellingProducts;

PySpark Equivalent:

In PySpark, you would break down these steps into distinct DataFrame operations. While a direct line-by-line translation isn’t always possible due to differences in how SQL and PySpark handle certain tasks, the logic can typically be restructured to fit the PySpark paradigm.

from pyspark.sql import SparkSession
from pyspark.sql import functions as F

# Initialize Spark Session
spark = SparkSession.builder.appName('TotalSalesByCategory').getOrCreate()

# Assuming the data paths and schema are defined or inferable.
# Replace these with the actual paths or database connections.
sales_path = 'path/to/sales_data.csv'
products_path = 'path/to/products_data.csv'

# Load data into DataFrames
sales_df =, header=True, inferSchema=True)
products_df =, header=True, inferSchema=True)

# Join operation between Sales and Products on ProductID
joined_df = sales_df.join(products_df, "ProductID")

# Calculate total sales and quantity sold by product, flag high sellers
intermediate_df = joined_df.groupBy("ProductID", "Category") \
F.sum("QuantitySold").alias("QuantitySold")) \
.withColumn("HighSeller", F.when(F.col("QuantitySold") > 50, 1).otherwise(0))

# Filter for high sellers and aggregate results by category
result_df = intermediate_df.filter("HighSeller = 1") \
.groupBy("Category") \

# Show the results

# Close the Spark Session when done

When converting SQL stored procedures to PySpark, it’s essential to understand how SQL commands translate into DataFrame operations. Each SQL operation, whether it’s a join, filter, or aggregation, has an equivalent in PySpark, but the syntax and approach will differ. By breaking down the stored procedure into its fundamental operations and systematically translating them into PySpark code, you can effectively migrate complex SQL logic to Databricks Workflows.


While SSIS and stored procedures have their place in certain scenarios, the shift towards Databricks Workflow represents a significant step forward in data engineering and analytics. Its scalability, flexibility, cloud integration, and advanced analytics capabilities make it a superior choice for businesses looking to modernize their data export processes from SQL databases to data warehouses.

As data volumes continue to grow and real-time insights become increasingly crucial, leveraging Databricks Workflow will become not just an option but a necessity for remaining competitive in the data-driven business landscape.

Generative AI can assist in translating complex SSIS packages into PySpark or Spark SQL scripts for Databricks. By understanding the patterns and logic of the existing ETL tasks, AI can suggest and generate the necessary code, reducing the manual effort and time required for conversion.