This chapter covers the core features and capabilities of Databricks Notebook Framework.
A complete, battle-tested framework for building Databricks notebooks that follow medallion architecture best practices. Stop reinventing the wheel on every project — start with production-ready templates that handle logging, error handling, data quality, configuration, and CI/CD out of the box.
databricks-notebook-framework/
├── README.md # This file
├── manifest.json # Package manifest
│
├── notebooks/
│ ├── bronze_ingest_template.py # Bronze layer ingestion template
│ ├── silver_transform_template.py # Silver layer transformation template
│ └── gold_aggregate_template.py # Gold layer aggregation template
│
├── ingestion_templates/
│ ├── base_pipeline.py # Abstract base pipeline class (merge/append/overwrite)
│ ├── api_ingestion.py # REST API ingestion with pagination & retry
│ ├── database_ingestion.py # JDBC database ingestion (full/incremental)
│ ├── file_ingestion.py # File-based ingestion (CSV, JSON, Parquet, etc.)
│ └── streaming_ingestion.py # Event Hub / Kafka streaming ingestion
│
├── unity_catalog_setup/
│ ├── setup_catalogs.sql # SQL to create Unity Catalog catalogs
│ ├── setup_credentials.sql # Storage credential configuration
│ ├── setup_external_locations.sql # External location definitions
│ └── data_governance_policies.md # Data governance policy documentation
│
├── medallion_bootstrap/
│ ├── config.py # Bootstrap configuration (catalogs, schemas, groups)
│ ├── 01_create_catalogs.py # Step 1: Create Unity Catalog catalogs
│ ├── 02_create_schemas.py # Step 2: Create schemas in each catalog
│ └── 03_grant_permissions.py # Step 3: Grant RBAC permissions to groups
│
├── utils/
│ ├── logging_utils.py # Structured logging module
│ ├── config_manager.py # Widget & environment config management
│ ├── quality_checks.py # Data quality validation functions
│ ├── secrets_manager.py # Secrets retrieval wrapper
│ └── environment.py # Environment detection & workspace config
│
├── testing/
│ ├── test_framework.py # Nutter-pattern notebook testing framework
│ └── conftest.py # Pytest fixtures with mock dbutils & spark
│
├── cicd/
│ ├── pre-commit-config.yaml # Pre-commit hooks for notebook linting
│ └── databricks.yml # DABs bundle configuration template
│
├── standards/
│ └── NOTEBOOK_STANDARDS.md # Notebook development standards
│
└── project-scaffold/
└── README.md # Quick-start scaffold instructions
Copy this framework into your Databricks Repos or local project directory:
cp -r databricks-notebook-framework/ /path/to/your/project/Update utils/config_manager.py defaults for your catalog, schema, and environment naming conventions.
For multi-environment setups, update utils/environment.py with your workspace IDs:
from utils.environment import get_environment
env = get_environment() # Auto-detect from workspace
env = get_environment("dev") # Explicit override
print(env.bronze_catalog) # "dev_bronze"
print(env.storage.raw_root) # "abfss://raw@styourorgdev.dfs.core.windows.net"Use the medallion_bootstrap/ scripts to set up catalogs, schemas, and permissions:
# In a Databricks notebook — run in order:
%run ./medallion_bootstrap/config
%run ./medallion_bootstrap/01_create_catalogs
%run ./medallion_bootstrap/02_create_schemas
%run ./medallion_bootstrap/03_grant_permissionsOr use the Unity Catalog SQL scripts for a SQL-first approach:
-- Run in a SQL notebook or editor:
-- 1. setup_catalogs.sql
-- 2. setup_credentials.sql
-- 3. setup_external_locations.sqlStart from any template in notebooks/:
# Copy bronze_ingest_template.py
# Update widget defaults for your source
# Implement source-specific read logic in the marked section
# Run and verifyFor production ingestion, use the OOP pipeline templates:
from ingestion_templates.api_ingestion import ApiIngestionPipeline
from ingestion_templates.base_pipeline import PipelineConfig
config = PipelineConfig(
pipeline_name="my_api_pipeline",
source_system="salesforce",
source_class="accounts",
target_catalog="prod_bronze",
target_schema="salesforce",
target_table="accounts",
write_mode="merge",
)
pipeline = ApiIngestionPipeline(config=config, ...)
pipeline.run()For streaming sources (Event Hub / Kafka):
from ingestion_templates.streaming_ingestion import (
StreamingIngestionPipeline, EventHubConfig, StreamConfig,
)
from ingestion_templates.base_pipeline import PipelineConfig
pipeline = StreamingIngestionPipeline(
config=pipeline_config,
eh_config=eh_config,
stream_config=stream_config,
)
pipeline.run_streaming()Import quality check functions into your Silver and Gold notebooks:
from utils.quality_checks import QualityChecker
checker = QualityChecker(spark)
results = checker.run_all_checks(df, config)1. Copy cicd/pre-commit-config.yaml to your repo root as .pre-commit-config.yaml
2. Customize cicd/databricks.yml for your DABs deployment
3. Run pre-commit install
Follow this guide to get Databricks Notebook Framework up and running in your environment.
The ingestion_templates/ directory contains production-ready OOP pipeline classes:
| Template | Description |
|---|---|
base_pipeline.py | Abstract base class with merge/append/overwrite write modes, deduplication, metadata columns, schema/table auto-creation |
api_ingestion.py | REST API ingestion with pagination, retry logic, and rate limiting |
database_ingestion.py | JDBC database ingestion supporting full and incremental (watermark) loads |
file_ingestion.py | File-based ingestion for CSV, JSON, Parquet, and other formats from cloud storage |
streaming_ingestion.py | Structured Streaming from Azure Event Hub (OAuth/connection string) or Apache Kafka (SASL/SSL) with checkpoint management |
All templates inherit from BasePipeline and share a consistent PipelineConfig interface.
The unity_catalog_setup/ directory contains SQL scripts for Unity Catalog infrastructure:
| File | Description |
|---|---|
setup_catalogs.sql | Creates bronze, silver, gold, and sandbox catalogs with properties and comments |
setup_credentials.sql | Configures storage credentials for Azure ADLS, AWS S3, and GCS |
setup_external_locations.sql | Defines external locations for raw data landing zones |
data_governance_policies.md | Data governance policy documentation covering classification, access, retention, and quality |
The medallion_bootstrap/ directory provides a programmatic approach to setting up the medallion architecture:
| File | Description |
|---|---|
config.py | Central configuration: catalog definitions, schema lists, group RBAC definitions |
01_create_catalogs.py | Creates Unity Catalog catalogs with properties and comments |
02_create_schemas.py | Creates schemas within each catalog with ownership assignment |
03_grant_permissions.py | Grants role-based permissions to Databricks groups on catalogs and schemas |
Run these scripts in order (01 → 02 → 03) in a Databricks notebook.
Get the full Databricks Notebook Framework and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.