Data Usage Patterns: Who Uses What at Each Layer
A common mistake in data engineering is building a data platform without understanding who will use it and how. The Medallion Architecture (Bronze â Silver â Gold) is not just a storage pattern â it's a usage pattern. Each layer serves different consumers with different query patterns, latency requirements, and quality guarantees.
The Medallion Architecture Layers
| Layer | Also Known As | Quality | Primary Consumer | Query Pattern |
|---|---|---|---|---|
| Bronze | Raw, Landing | Raw, unvalidated | Data Engineers | Debugging, auditing |
| Silver | Curated, Cleaned | Validated, deduplicated | Data Scientists, Analysts | Exploration, ML |
| Gold | Aggregated, Business | Business-ready | BI Analysts, Executives | Dashboards, reports |
đ¯
Interview Question: "How do you implement access control in a Medallion architecture?" Answer: Bronze: Restrict to data engineers and auditors only (IAM roles: data-engineer). Silver: Domain-based access (marketing-analyst, finance-analyst). Gold: Role-based access for all analysts and executives. Use Lake Formation or similar for fine-grained permissions.
Bronze Layer: Raw Data
What It Contains
- Raw data as-is from source systems
- No transformations applied
- Full history preserved
- Schema-on-read (schema applied at query time)
Who Uses It
- Data Engineers â Debugging pipeline issues, validating data quality
- Data Scientists â Exploring raw data for feature engineering
- Compliance Officers â Auditing raw data for regulatory requirements
Query Patterns
-- Data Engineer: Debugging a pipeline issue
SELECT * FROM bronze.orders
WHERE ingestion_date = '2024-01-15'
AND raw_payload LIKE '%error%'
LIMIT 100;
-- Data Scientist: Exploring raw clickstream data
SELECT raw_payload
FROM bronze.clickstream
WHERE event_date = '2024-01-15'
LIMIT 1000;
đ
Production Tip: This code example demonstrates core concepts. In production, add error handling, logging, and monitoring. Always validate inputs and handle edge cases.
Characteristics
- Latency tolerance: Minutes to hours (not time-sensitive)
- Data quality: None (raw, unvalidated)
- Retention: Long-term (7+ years for compliance)
- Access control: Restricted to authorized engineers and auditors
- Cost: Low (cheap storage, infrequent queries)
SLA
- Freshness: Ingestion latency (minutes to hours)
- Availability: Best effort (not SLA-critical)
- Accuracy: Raw data, no quality guarantees
Silver Layer: Curated Data
What It Contains
- Cleaned, validated, deduplicated data
- Schema applied (schema-on-write)
- Conformed dimensions
- Basic quality checks passed
Who Uses It
- Data Scientists â Feature engineering, model training
- Data Analysts â Ad-hoc analysis, exploration
- ML Engineers â Feature stores, training data
- Data Engineers â Building Gold layer aggregations
Query Patterns
-- Data Scientist: Building features for ML
SELECT
customer_id,
COUNT(DISTINCT order_id) as total_orders,
SUM(amount) as total_spend,
AVG(amount) as avg_order_value,
DATEDIFF('day', MIN(order_date), MAX(order_date)) as customer_tenure
FROM silver.orders
WHERE order_date >= '2023-01-01'
GROUP BY 1;
-- Data Analyst: Ad-hoc analysis
SELECT
p.category,
p.brand,
SUM(o.amount) as revenue,
COUNT(DISTINCT o.customer_id) as unique_customers
FROM silver.orders o
JOIN silver.products p ON o.product_id = p.product_id
WHERE o.order_date BETWEEN '2024-01-01' AND '2024-01-31'
GROUP BY 1, 2
ORDER BY 3 DESC;
Characteristics
- Latency tolerance: Seconds to minutes
- Data quality: Validated, deduplicated
- Retention: Medium-term (1-3 years)
- Access control: Domain-based access control
- Cost: Medium (query-optimized storage)
SLA
- Freshness: Within 1 hour of source update
- Availability: 99.5% uptime
- Accuracy: Validated against quality rules
Gold Layer: Business-Ready Data
What It Contains
- Aggregated, business-ready data
- Pre-computed metrics and KPIs
- Conformed across domains
- Dashboard-ready
Who Uses It
- BI Analysts â Building dashboards and reports
- Executives â Strategic decision-making
- Business Users â Self-service analytics
- Finance â Financial reporting and compliance
Query Patterns
-- BI Analyst: Dashboard query
SELECT
date,
category,
revenue,
units,
unique_customers,
avg_order_value
FROM gold.daily_sales_summary
WHERE date >= CURRENT_DATE - 30
ORDER BY date;
-- Executive: Monthly P&L
SELECT
month,
SUM(revenue) as total_revenue,
SUM(cost) as total_cost,
SUM(revenue) - SUM(cost) as profit,
(SUM(revenue) - SUM(cost)) / SUM(revenue) * 100 as margin_pct
FROM gold.monthly_financial_summary
WHERE year = 2024
GROUP BY 1
ORDER BY 1;
Characteristics
- Latency tolerance: Sub-second (dashboard SLA)
- Data quality: Business-validated, reconciled
- Retention: Long-term (5+ years)
- Access control: Role-based access control
- Cost: High (query-optimized, high concurrency)
SLA
- Freshness: Within 24 hours (daily refresh)
- Availability: 99.9% uptime (production dashboards)
- Accuracy: Reconciled against source systems
Consumer-to-Layer Mapping
| Consumer Role | Primary Layer | Secondary Layer | Query Frequency |
|---|---|---|---|
| Data Engineer | Bronze | Silver | High (debugging) |
| Data Scientist | Silver | Bronze | Medium (exploration) |
| ML Engineer | Silver | Gold | Medium (training) |
| Data Analyst | Silver | Gold | High (analysis) |
| BI Analyst | Gold | Silver | Very High (dashboards) |
| Executive | Gold | - | Low (strategic) |
| Compliance | Bronze | Gold | Low (auditing) |
| Business User | Gold | - | Medium (self-service) |
Query Pattern Analysis by Layer
Bronze Query Patterns
- Full table scans â No indexes, raw data exploration
- Regex/JSON parsing â Extracting fields from raw payloads
- Sampling â
TABLESAMPLE BERNOULLI (1)for quick exploration - Time-based filtering â Filter by ingestion timestamp
Silver Query Patterns
- Joins â Combining fact and dimension tables
- Aggregations â GROUP BY with business logic
- Window functions â Rankings, running totals, time-series
- Deduplication â DISTINCT, ROW_NUMBER for dedup
Gold Query Patterns
- Simple aggregations â Pre-computed, dashboard-ready
- Filtering â Date ranges, categories, segments
- Drill-down â Year â Quarter â Month â Day
- Comparison â YoY, MoM, target vs actual
Access Control by Layer
| Layer | Access Control | Example |
|---|---|---|
| Bronze | Restricted (engineers only) | IAM role: data-engineer |
| Silver | Domain-based | IAM role: marketing-analyst |
| Gold | Role-based | IAM role: bi-analyst, executive |
-- Lake Formation: Layer-based access control
-- Bronze: Only data engineers
GRANT SELECT ON TABLE bronze.orders TO ROLE 'data-engineer';
-- Silver: Domain analysts
GRANT SELECT ON TABLE silver.orders TO ROLE 'marketing-analyst';
GRANT SELECT ON TABLE silver.customers TO ROLE 'marketing-analyst';
-- Gold: All analysts and executives
GRANT SELECT ON ALL TABLES IN SCHEMA gold TO ROLE 'bi-analyst';
GRANT SELECT ON ALL TABLES IN SCHEMA gold TO ROLE 'executive';
Cost Attribution by Layer
Understanding cost per layer helps optimize spending:
| Layer | Storage Cost | Compute Cost | Total Cost |
|---|---|---|---|
| Bronze | Low ($0.023/GB) | Low (rare queries) | Low |
| Silver | Medium ($0.03/GB) | Medium (analyst queries) | Medium |
| Gold | High ($0.03/GB) | High (dashboard queries) | High |
Cost Optimization Strategies:
- Bronze: Use S3 Glacier for long-term retention
- Silver: Partition by date, use Parquet for compression
- Gold: Pre-aggregate to reduce query volume, use materialized views
SLA Framework by Layer
| SLA Dimension | Bronze | Silver | Gold |
|---|---|---|---|
| Freshness | Hours | 1 hour | 24 hours |
| Availability | Best effort | 99.5% | 99.9% |
| Accuracy | Raw | Validated | Reconciled |
| Query Latency | Minutes | Seconds | Sub-second |
| Concurrency | 1-5 users | 10-50 users | 100-1000 users |
Best Practices
- Document layer ownership â Each layer should have a clear owner
- Define SLAs per layer â Set freshness, availability, and accuracy targets
- Implement access control â Restrict Bronze to engineers, Gold to business users
- Track query patterns â Monitor which layers get the most queries
- Attribute costs â Track storage and compute costs per layer
- Optimize for consumers â Pre-aggregate Gold for dashboards, keep Silver flexible for analysts
- Implement data contracts â Define quality guarantees per layer
- Monitor layer health â Track freshness, quality, and SLA compliance per layer
- Automate layer promotion â Use Airflow/dbt to promote data from Bronze â Silver â Gold
- Version layer schemas â Use schema registries for backward compatibility
Knowledge Check
Key Takeaways
- Each Medallion layer serves different consumers with different needs
- Bronze: Data engineers debug, compliance auditors verify
- Silver: Data scientists explore, analysts analyze, ML engineers build features
- Gold: BI dashboards, executive reports, business self-service
- SLAs, access control, and cost vary significantly by layer
- Understanding consumer-to-layer mapping is critical for platform design