Skip to main content

Modular Databricks pipelines with common, mock, and bronze layers

Project description

๐Ÿš€ Databricks Pipelines โ€“ Modular Unity Architecture (Notebooks + Python)

This repository contains scalable, modular data pipelines built on Azure Databricks, featuring Unity Catalog, Delta Lake, Azure Blob Storage, SQL Server (via JDBC), and Azure Data Factory (ADF).

It supports dual execution modes:

  • Notebook-driven orchestration (for exploration and visualization)
  • Git-tracked Python scripts (for production-ready, CI/CD-compliant workflows)

๐Ÿ’ก All data is now managed through Unity Catalog, with Delta tables registered in thebetty catalog under Bronze, Silver, and Gold schemas.
Raw source data still flows through Azure Blob containers (e.g., raw-ingest, external-ingest) before being processed into Unity-managed Volumes.


๐Ÿง  Whatโ€™s New in This Version?

  • โœ… Full transition to Unity Catalog: /Volumes/thebetty/... + thebetty.<schema>.<table>
  • โœ… Modular Python-based pipeline executed via Databricks Workflows
  • โœ… Registered Delta tables for BI/SQL access at each layer
  • โœ… SQL Server ingestion via secure JDBC + Ngrok + Key Vault
  • โœ… Structured logging of pipeline runs to Gold

๐Ÿ“ Unity Catalog Overview

Layer Path Example Unity Table Example
Bronze /Volumes/thebetty/bronze/inventory thebetty.bronze.inventory
Silver /Volumes/thebetty/silver/finance_with_vendor_info thebetty.silver.finance_with_vendor_info
Gold /Volumes/thebetty/gold/final_vendor_summary thebetty.gold.final_vendor_summary
Logs /Volumes/thebetty/gold/logs/final_vendor_summary_runs thebetty.gold.final_vendor_summary_runs

๐Ÿ“ฆ Project Structure

databricks-pipelines/
โ”œโ”€โ”€ pipeline1_batch_delta/
โ”‚   โ”œโ”€โ”€ bronze_py/             # Python-based ingestion scripts (Unity Bronze)
โ”‚   โ”œโ”€โ”€ silver_py/             # Python-based transformation and joins (Unity Silver)
โ”‚   โ”œโ”€โ”€ gold_py/               # Python-based aggregations and outputs (Unity Gold)
โ”‚   โ”œโ”€โ”€ utils_py/              # Reusable utility functions (e.g., upsert, write)
โ”‚   โ”œโ”€โ”€ tests/                 # Unit tests and mock data validations
โ”‚   โ””โ”€โ”€ docs/                  # Optional design notes or diagrams
โ”œโ”€โ”€ common/                    # Shared modules across pipelines (planned)
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md

๐Ÿš€ Dual Execution Modes

You can now run this pipeline in two different ways:

โ–ถ๏ธ Option 1: Notebook Workflow
Execute directly in Databricks Repos UI:
bronze/ โ†’ silver/ โ†’ gold/

โ–ถ๏ธ Option 2: Python Job Workflow
Run the batch1_py_pipeline job via Databricks Workflows:
bronze_py/ โ†’ silver_py/ โ†’ gold_py/
Each script uses utilities in utils_py/ for modularity and testing.


๐Ÿ” Pipeline Variants (Planned)

Pipeline Features
pipeline1_batch_delta Batch ingestion (ADF + Blob + SQL) โ†’ Silver normalization โ†’ Gold aggregation
FUTURE-pipeline2_modular_functions Centralized utilities (upsert, SQL, mount) reusable across pipelines
FUTURE-pipeline3_autoloader_batch Ingest batch files via Autoloader (triggered)
FUTURE-pipeline4_streaming_mode Continuous Structured Streaming ingestion

๐Ÿงฐ Technologies

๐Ÿ”น Compute & Processing

  • Azure Databricks (Runtime 15.4+)
  • PySpark

๐Ÿ”น Ingestion & Integration

  • Azure Data Factory (ADF) for vendor registry
  • SQL Server via JDBC tunnel + Ngrok
  • Azure Blob Storage: Raw file drop zone

๐Ÿ”น Data Management

  • Delta Lake (Bronze, Silver, Gold architecture)
  • Unity Catalog: Unified governance for all tables
  • Databricks Workflows: Visual pipeline orchestration

๐Ÿ”น Security & Source Control

  • GitHub with Databricks Repos
  • Azure Key Vault + Secret Scope (databricks-secrets-lv426)

๐Ÿ“Š Pipeline Flow

Azure Blob + ADF + SQL Server
โ”‚
โ–ผ
๐ŸŸซ Bronze Layer (Ingestion)
  - Ingest raw CSV, JSON, and SQL data (JDBC)
  - No transformations

โšช Silver Layer (Cleansing)
  - Normalize, deduplicate, validate
  - Join registry + compliance + finance

๐Ÿฅ‡ Gold Layer (Aggregation)
  - Join Silver datasets
  - Aggregate by vendor_id
  - Partitioned by `tier`
  - Tracked via pipeline run timestamp

๐Ÿ“ˆ Gold Output

Column Description
vendor_id Unique vendor identifier
vendor_name Clean, human-readable name
total_invoices Distinct invoice count
latest_due_date Most recent due date
latest_invoice_date Most recent invoice date
last_audit_date Most recent compliance audit
compliance_score Latest score (0โ€“100 scale)
compliance_status Compliant, At Risk, etc.
industry Vendor industry from registry
headquarters City from registry
onwatchlist Boolean flag from registry
registration_date Original vendor registration date
tier Vendor tier from ADF
pipeline_run_timestamp Ingestion run timestamp

๐Ÿ”— SQL Server Integration via Ngrok + Key Vault

  • Tunnels from localhost:1433 to public via Ngrok
  • Uses Azure Key Vault for:
    • JDBC URL
    • SQL Username / Password
jdbc_url = dbutils.secrets.get(scope="databricks-secrets-lv426", key="sql-jdbc-url")
df = spark.read.jdbc(url=jdbc_url, table="your_table_name", properties=...)

๐Ÿ”’ Security Highlights

  • ๐Ÿ” No plaintext credentials
  • โœ… GitHub secrets excluded
  • ๐Ÿ” Secrets managed with Azure Key Vault + Databricks scopes
  • โœ… Volumes replace legacy mounts

๐Ÿชช License

MIT License
Maintained by AstroSpiderBaby
Last updated: July 29, 2025

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

databricks_pipelines-0.2.8.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

databricks_pipelines-0.2.8-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file databricks_pipelines-0.2.8.tar.gz.

File metadata

  • Download URL: databricks_pipelines-0.2.8.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for databricks_pipelines-0.2.8.tar.gz
Algorithm Hash digest
SHA256 6956f745f36ee4bc8e2ef03795ca682d860b9cf1710f813bb46a21f54e4e5f95
MD5 2af6a352af9293e78ae4825ef24896f3
BLAKE2b-256 c87f5bee64e611912eec25d3b1e4819d6cd4a82e70c3e12647df3741d019cf5e

See more details on using hashes here.

File details

Details for the file databricks_pipelines-0.2.8-py3-none-any.whl.

File metadata

File hashes

Hashes for databricks_pipelines-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 230e632b5825ca8bd6fb7e63965cca8b38f63843a90457d3a559784cfe5095c4
MD5 6b9b47abdbf49aa0a0ba717eed44fe1e
BLAKE2b-256 c00888b69ed456757b2ac890e0e710575a780dfd7bb80dfcf775a24f380aba37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page