Igniting Powerful INSIGHTS
The Challenge
The enterprise faced several critical business and technical pain points: Data Silos & Diverse Formats: The bank generated massive volumes of data from its core banking system (Azure SQL), external payment gateways, and credit bureaus. This data was spread across multiple cloud platforms and existed in different formats (structured SQL tables vs. semi-structured CSV/JSON files). Lack of Unified Analytics: Business teams lacked a combined, 360-degree overview of customers, branches, and transactions, making unified cross-domain reporting impossible. Scalability & Maintenance Overhead: Due to strict financial regulations and high data volume, building manual, hardcoded pipelines for each table was slow, highly fragile, and difficult to audit. No Self-Service Analytics: Business users lacked the ability to query data independently, relying heavily on technical teams to write SQL, resulting in high latency for insights. Data Quality & PII Compliance: Existing pipelines lacked automated data validation, risking inaccurate reporting, and did not adequately enforce column-level masking for Personally Identifiable Information (PII).
Goals & Objectives
The primary objectives of the solution were to: 1. Integrate cross-cloud relational and unstructured data sources into a single, governed Databricks analytics platform. 2. Build a highly reusable, metadata-driven framework to automate pipeline creation for future tables without requiring code changes. 3. Implement a Medallion architecture ensuring data quality, historical tracking (SCD Type 2), and optimized query performance. 4. Provide self-service business intelligence through custom dashboards and AI-driven natural language querying. 5. Enforce strict governance, automated auditing, PII masking, and SLA-driven alerting throughout the data lifecycle.
Solution / Approach
The solution was designed as a dynamic metadata-driven framework utilizing Databricks' native compute, storage, and AI capabilities. Instead of hardcoding pipeline logic for each table, the system relies on a central metadata database (built as Delta tables) containing source paths, watermark columns, primary keys, and SCD types. The architecture follows a strict Medallion approach: Bronze Layer: Stores raw, unprocessed data appended directly from sources, maintaining a full, immutable historical record. Silver Layer: Acts as an exact, refined, and conformed copy of the source. It handles upserts, appends, and full loads based on metadata parameters. This layer implements SCD Type 2 for customer profiles to track historical changes in credit scores and risk grades. Gold Layer: Contains highly aggregated, business-ready tables optimized for BI consumption, utilizing star-schema modeling principles. To orchestrate this, a Master Databricks Workflow was created. It triggers nested jobs that process SQL Server and Cloud Storage data in parallel, followed by Gold layer transformations, automated email notifications, and dashboard refreshing. Unity Catalog governs all data assets, ensuring centralized role-based access control (RBAC) and dynamic column masking for sensitive fields like SSNs and phone numbers.
Process / Workflow
The end-to-end workflow operates as follows: 1. Source Connectivity & Security: Relational Sources: Core banking tables (Branches, Customers, Accounts, Transactions) are ingested from an Azure SQL Database. File Sources: External datasets (Credit Bureau Reports, Payment Gateway Logs) land in an AWS S3 bucket, mapped to Databricks Volumes. Security: A Databricks-backed Secret Scope (backed by Azure Key Vault) securely stores JDBC credentials and SMTP API keys as JSON payloads, retrieved dynamically via `dbutils.secrets.get()`. 2. Metadata Configuration: A `banking` catalog is created with `metadata`, `bronze`, `silver`, and `gold` schemas. Metadata tables (`tables`, `table_parameters`, `table_watermarks`, `pipeline_runs`) are populated to drive the logic. Data quality rules (e.g., non-null constraints, range checks) are also stored here. 3. Source to Bronze Ingestion: A driver notebook reads the metadata to identify active tables and extracts configurations. For SQL Server, PySpark JDBC connections pull data dynamically, utilizing predicate pushdown and watermark filters (e.g., `WHERE updated_at > last_watermark`) for highly efficient incremental loads. For Cloud Storage, Databricks Autoloader (`spark.readStream.format("cloudFiles")`) streams files into Delta tables, utilizing `schemaLocation` for automatic schema inference/evolution, and `_rescued_data` columns to prevent pipeline failures from malformed records. 4. Bronze to Silver Processing: A reusable notebook reads the newly appended Bronze data. It applies Databricks Expectations (data quality checks) to drop or fail bad records. Based on metadata parameters, it executes Delta Lake `MERGE` operations. For customer data, it performs SCD Type 2 operations to maintain historical state. Post-merge, the `table_watermarks` table is updated. 5. Silver to Gold Transformations: A driver notebook orchestrates specific transformation notebooks using `dbutils.notebook.run()`. These notebooks perform complex Spark SQL joins, window functions, and aggregations to create business-ready tables (e.g., Branch Performance, Customer 360, Daily Bank KPIs). Gold tables are optimized with Z-Ordering on high-cardinality filter columns. 6. Automated Alerting: A custom notebook queries the `pipeline_runs` audit table, dynamically calculates success/failure counts, converts the Spark DataFrame into an HTML table, and dispatches an SMTP email to stakeholders via secure API integration. 7. Dashboard Refresh: The master workflow triggers a final task to programmatically refresh the published Databricks Dashboard via the Jobs API, ensuring business users always view the most recent data.
Key Features
- Metadata-Driven Reusability: Adding a new table to the pipeline requires zero code changes—simply inserting a row into the metadata table dictates its source path, load strategy, primary keys, and target schema.
- Idempotent Pipelines & Strict Auditing: An audit table tracks Run ID, Table ID, layer, start/end times, status, record counts, and error messages. Pipelines are safe to retry; upserts on the audit table prevent duplicate entries during transient failure retries.
- Advanced Data Governance: Unity Catalog enforces dynamic row-level and column-level masking, ensuring analysts can query data without exposing restricted PII.
- Multi-Platform Integration: Syncs with study calendars, learning management systems, and task planners.
- Self-Service AI Analytics: Business users can query the Gold layer using natural language (e.g., "Which branch has the highest transaction volume?") via Databricks Genie, without writing SQL.
- AI-Assisted Dashboarding: Visualizations were generated using Databricks' built-in AI capabilities by simply providing text prompts (e.g., "Show me gateway-wise transaction success and failures as a bar chart").
Technical Highlights
- Data Ingestion: Utilized PySpark, JDBC connections with predicate pushdown, and Databricks Autoloader for efficient file ingestion. Autoloader was configured with `AvailableNow` triggers to process new files in micro-batches while maintaining streaming checkpoint progress.
- Transformation Engine: Built using Apache Spark, Spark SQL, and Delta Lake. Implemented dynamic `MERGE` statements where join conditions were evaluated at runtime. Utilized Delta Lake features like Time Travel for data reproducibility and `OPTIMIZE` with Z-Ordering to accelerate BI query performance.
- Orchestration: Leveraged Databricks Workflows. Designed a Master Job that triggers nested "inner" jobs using a `For Each` task. Configured concurrency (parallel processing of up to 4 tables per run) and automated retries for transient connection failures. Inter-task communication was handled via `dbutils.jobs.taskValues.set()` to pass complex JSON metadata arrays.
- Governance & CI/CD: Implemented Unity Catalog for centralized governance. Project artifacts and notebooks were managed via Git integration, deployed using Databricks Asset Bundles (DABs) for automated CI/CD across dev/staging/prod environments.
- Consumption Layer: Built a multi-page Databricks Dashboard backed by parameterized SQL datasets running on Serverless SQL Warehouses. Configured a Databricks Genie Workspace by providing explicit instructions, table joining conditions, and verified SQL expressions to ground the LLM and enhance NLP accuracy.
Benefits / Impact
- Eliminated Data Silos: Successfully merged structured SQL data and semi-structured file data into a single source of truth on the Data Lakehouse.
- Massive Scalability & Lower TCO: The metadata framework allows the data engineering team to scale the pipeline to hundreds of new tables with minimal effort. Transitioning to Job Clusters and Serverless SQL reduced cloud compute costs by 30%.
- Resilience & Reliability: Automated retries, strict data quality expectations, and Delta Lake's ACID compliance ensure that transient network failures or malformed data rows do not corrupt the database or break downstream reporting.
- Empowered Business Users: The combination of auto-refreshing visual dashboards and Genie AI allows non-technical users to derive insights instantly, shifting the analytical workload away from the engineering team.
- Strict SLA Compliance: End-to-end orchestration with dependency management ensures that Gold tables and BI dashboards are refreshed within scheduled SLA windows, with immediate email alerts for any pipeline anomalies.
Conclusion
This enterprise banking project exemplifies a modern, scalable data engineering solution. By combining a Medallion architecture with a strict metadata-driven framework, the system is highly adaptable, governable, and resilient. The integration of advanced Delta Lake features, data quality expectations, and AI-assisted dashboards bridges the gap between complex data pipelines and business consumption.