Purpose
The Silver layer provides:Data Cleansing
Removes duplicates, handles nulls, and corrects data quality issues
Standardization
Converts codes to readable values and standardizes formats
Validation
Applies business rules and data validation logic
Enrichment
Derives new fields and calculates computed values
Transformation Types
Deduplication
Removes duplicate records using window functions to keep only the most recent version:This pattern ensures only the latest customer record is retained based on the creation date.
Code Standardization
Converts abbreviated codes into human-readable values:- Gender Codes
- Marital Status
- Product Line
- Country Codes
Date Formatting
Converts integer date values (YYYYMMDD format) to proper DATE types:Data Validation and Correction
Sales Amount Validation
Ensures sales amounts are consistent with quantity and price:Price Correction
Handles negative or null prices:Data Enrichment
Category Extraction
Extracts category ID from product key:Product End Date Calculation
Uses LEAD window function to calculate product end dates:Customer ID Normalization
Removes prefixes and standardizes customer IDs:Transformation Examples
Customer Information Transformation
Sales Details Transformation
Silver Tables
Each Silver table includes adwh_create_date timestamp for audit tracking:
silver.crm_cust_info
silver.crm_cust_info
Cleansed customer information with standardized gender and marital status codes.Added Transformations:
- Deduplication by customer ID
- Gender code expansion (M → Male, F → Female)
- Marital status code expansion (S → Single, M → Married)
- Trimmed whitespace from string fields
silver.crm_prd_info
silver.crm_prd_info
Product catalog with extracted category ID and calculated end dates.Added Transformations:
- Category ID extracted from product key
- Product line code expansion
- Cost NULL handling (defaults to 0)
- Product end date calculation using LEAD window function
silver.crm_sales_details
silver.crm_sales_details
Sales transactions with validated amounts and converted dates.Added Transformations:
- Integer dates converted to DATE type
- Sales amount validation against quantity × price
- Price validation and correction
- Invalid date handling
silver.erp_cust_az12
silver.erp_cust_az12
ERP customer demographics with normalized IDs.Added Transformations:
- ‘NAS’ prefix removal from customer IDs
- Future birth date validation
- Gender code standardization
silver.erp_loc_a101
silver.erp_loc_a101
Location data with standardized country names.Added Transformations:
- Hyphen removal from customer IDs
- Country code standardization
silver.erp_px_cat_g1v2
silver.erp_px_cat_g1v2
Product category information (minimal transformation).
Loading Process
Thesilver.load_silver() procedure executes transformations:
The procedure processes all six tables sequentially with comprehensive error handling and performance logging.
Data Quality Rules
No Duplicates
Only the latest version of each record is retained
Valid Dates
All dates are validated and invalid values converted to NULL
Consistent Codes
All code values expanded to readable descriptions
Accurate Calculations
Sales amounts validated against quantity and price
Next Steps
Gold Layer Analytics
Learn how Silver data is modeled into star schema for analytics
Related Resources
Bronze Layer
Raw data ingestion layer
ETL Procedures
Detailed ETL orchestration documentation