catalog = spark.sql("SELECT current_catalog()").first()[0]
spark.sql(f"USE SCHEMA {catalog}.dbx_course")
Module 19: Advanced Lakehouse Architecture
Lakehouse architecture at scale: mesh, multi-workspace, DR and open formats.
Topics in this module
- Medallion Architecture at Scale
- Batch, Streaming, and Hybrid Architectures
- Lambda vs Kappa Architecture
- CDC-Based Lakehouse
- Data Mesh and Data Products
- Multi-Workspace Architecture
- Multi-Cloud Architecture
- Enterprise Data Modeling
- Open Table Formats and Interoperability
- Data Sharing Architecture
- High Availability and Disaster Recovery
- Well-Architected Lakehouse Design
Design a lakehouse that stays understandable as it grows. This is an architecture module: mostly concept with small code checks you can run. Most real multi-workspace and multi-cloud designs need admin features that Free Edition doesn't have.
- Names and facts here come from the Databricks architecture docs. Cloud and product details change: confirm on the current pages before designing for real
- Reuse the
orders,customerstables from Module 4 where code appears
Medallion Architecture at Scale
By the end: scale the medallion architecture beyond one pipeline.
| Layer | At scale |
|---|---|
| Bronze | Source data as received, with ingestion metadata. Strings, VARIANT or binary are fine. Keep full history for audit and replay |
| Silver | Validated and typed: dedupe, nulls handled, joins made. Keep at least one clean, non-aggregated copy of each record |
| Gold | Business models, aggregates, dimensional marts. Often separate gold areas per domain (finance, HR) |
- Silver reads from bronze, often as a stream: don't write straight from ingestion to silver
- Medallion is a recommended pattern, not a requirement: keep it simple for small tables
- At scale add: one schema per layer and domain, naming rules, owners, and quality rules at each hop
- Ingestion frequency is a cost and latency choice: continuous = fastest and dearest, triggered = balanced, batch = cheapest
%sql
-- one schema per layer, per domain: a naming convention you can read
SHOW SCHEMAS
Domain first, then layer
sales_bronze, sales_silver, sales_gold scales better than one giant bronze schema for every team.
Batch, Streaming, and Hybrid Architectures
By the end: choose between batch, streaming and hybrid architectures.
| Pattern | Fits |
|---|---|
| Batch | Reports, daily aggregates, most analytics |
Incremental batch (availableNow, triggered pipelines) |
Minutes latency at batch cost (Module 11) |
| Streaming | Fraud, alerts, operational features |
| Hybrid | Fresh dashboards from a stream, exact figures from a nightly batch |
- Unified engine: same DataFrame code for batch and streaming
- Decide per dataset, not per company. Most tables don't need seconds
- Triggered pipelines give near-real-time at lower cost than always-on
Remember
Pick the slowest freshness the consumer can accept. It's the cheapest and simplest.
Lambda vs Kappa Architecture
By the end: tell Lambda and Kappa apart and see why the lakehouse reduces the need for Lambda.
- Lambda: exact but slow batch + fast but approximate stream. The cost: two implementations that must agree
- Kappa: stream only. Reprocessing needs a replayable log (such as Kafka with long retention)
- Delta tables are both a streaming sink and source, and a batch table: one code path with different triggers
- Reprocess by re-reading bronze in batch, or by a one-time backfill flow (Module 9.7)
- Keep bronze long enough to replay: retention is a design decision
Two paths that drift
Any design with separate batch and stream logic needs tests that compare their results (Module 14.7).
CDC-Based Lakehouse
By the end: structure a lakehouse around change data capture.
- Land the raw change events in bronze, append-only: this is your audit trail and replay source
- Apply changes to silver with
AUTO CDC(Module 9.9) orMERGE(Module 5.8) with a sequence column to order events - Choose SCD type 1 (current state) or type 2 (history) per table (Module 8.10)
- Deletes: a soft delete flag or a real delete (
APPLY AS DELETE), per policy and GDPR - Managed ingestion connectors (Lakeflow Connect) can capture from databases and SaaS apps: check availability for your workspace
- Test out-of-order, duplicate and late events (Module 14.9)
| Decision | Options |
|---|---|
| Keep history? | SCD 2 table, or time travel only |
| Delete handling | Soft delete, hard delete, tombstones |
| Ordering | Source sequence number or commit timestamp |
Data Mesh and Data Products
By the end: organise a data mesh with domain-owned data products.
- Data as a product: each product has an owner, a documented schema, a quality target, a freshness SLA and a place to ask questions
- Domains publish gold-level tables, views or metric views. Consumers don't read a domain's raw layers
- Unity Catalog supplies: catalogs per domain, tags (such as certified), comments, lineage, access requests, and sharing
- The platform team provides the paved road: templates, bundles, policies, CI/CD
- Federated governance: global rules, domain-level ownership
| Data product checklist | |
|---|---|
| Named owner and contact | Who fixes it? |
| Stable, documented schema | Consumers can rely on it |
| SLA and freshness | When is it ready? |
| Quality checks published | Can I trust it? |
| Access process | How do I get it? |
Mesh is organisation, not technology
It works only if teams have the skills and incentive to own their data. Start with one or two domains.
Multi-Workspace Architecture
By the end: design for several workspaces on one metastore.
| Reason for several workspaces | Notes |
|---|---|
| Environment separation (dev, test, prod) | Prod catalog bound to prod workspace |
| Team or domain isolation | Own compute, admins and quotas |
| Regulatory or regional boundaries | One metastore per region |
| Blast radius and limits | Separate quotas and permissions |
- Unity Catalog is the shared layer: users, groups and data policies at the account level
- Use workspace-catalog binding so prod data isn't visible from dev workspaces
- Deploy to all workspaces from the same repo with different targets (Module 15)
- Share across metastores or regions through sharing, not by pointing at storage
- More workspaces = more to administer. Don't split without a reason
Multi-Cloud Architecture
By the end: plan for more than one cloud.
- Reasons: a regulation, an acquisition, a customer requirement, or resilience
- Costs: more skills, more networking, egress fees, two sets of security setups
| Approach | How |
|---|---|
| Separate lakehouses per cloud | Same code from bundles, different targets. Data stays local |
| Share across clouds | Databricks-to-Databricks sharing or open sharing: no copy by the recipient |
| Open formats | Delta/Iceberg files that other engines can read |
| Replicate | Copy data with deep clone or cloud tools, for DR or locality |
- The platform is the same on each cloud: Unity Catalog, jobs, SQL, notebooks. Storage and networking differ
- Keep compute near data: cross-cloud reads are slow and cost egress
- Define one governance model (naming, tags, groups) and apply it everywhere with code
- Avoid cross-cloud designs unless a requirement forces them
Not hands-on
Free Edition runs on one cloud and one workspace. Read this as design reference.
Enterprise Data Modeling
By the end: model enterprise data for reuse.
| Level | What | Example |
|---|---|---|
| Conceptual | Business entities and relations | Customer places Order contains Product |
| Logical | Attributes, keys, grain | order(order_id, customer_id, ...) one row per order |
| Physical | Tables, types, clustering | Delta table with CLUSTER BY |
| Style | Use |
|---|---|
| Dimensional (star) | Analytics, BI (Module 8.8) |
| Data Vault (hubs, links, satellites) | Many sources, auditability, agility |
| Normalised (3NF) | Operational data, integration layers |
| One big table | A single consumer, simple queries |
- Model business entities once, as conformed dimensions (customer, product, date) used by many facts
- Document grain, keys and definitions. A metric view keeps measures (revenue) in one place
- Primary and foreign keys in Unity Catalog are informational: they document and can help the optimizer, but aren't enforced
- Don't over-model: start from the questions the business asks
%sql
-- document the model where people will see it
COMMENT ON TABLE orders IS 'Order header. Grain: one row per order. Owner: sales-data'
Open Table Formats and Interoperability
By the end: use open table formats and keep your data readable by other engines.
%sql
-- needs a Unity Catalog table; features and runtime versions apply
CREATE OR REPLACE TABLE orders_iceberg_readable (order_id INT, amount DOUBLE)
TBLPROPERTIES (
'delta.columnMapping.mode' = 'id',
'delta.enableIcebergCompatV2' = 'true',
'delta.universalFormat.enabledFormats' = 'iceberg')
| Format | Idea |
|---|---|
| Delta Lake | Default on Databricks. Transactions, time travel, CDF |
| Apache Iceberg | Open table format used by many engines. Managed Iceberg tables exist in Unity Catalog |
| Parquet | The file format underneath both |
- Iceberg reads (formerly UniForm): Delta tables expose Iceberg metadata. Clients get read-only access
- Requirements: Unity Catalog table, column mapping, no deletion vectors (purge with
REORGfirst) - Metadata generation is asynchronous after each commit
- Unity Catalog can act as an Iceberg REST catalog for external engines (see the current docs)
- Prefer open formats and interfaces: it keeps your options open
Free Edition
Whether Free Edition allows the Iceberg settings is not confirmed. Try the statement. If it errors, treat the topic as reference.
Data Sharing Architecture
By the end: choose a data sharing architecture.
| Need | Use |
|---|---|
| Same workspace or metastore | GRANT on tables, views |
| Other workspace, same metastore | Grant plus catalog binding |
| Another Databricks account or region | Databricks-to-Databricks sharing |
| Non-Databricks recipient | Open sharing (credentials file or token) |
| Public or paid datasets | Marketplace |
| Controlled analysis on combined data | Clean rooms |
- Sharing gives live, read-only access without copying to the recipient
- Share gold or views, not raw tables. Filter rows and columns in a view
- Recipient costs: their compute. Provider costs: egress across regions or clouds, if any
- Governance doesn't cross boundaries: recipients apply their own access control and lineage
- You can revoke access any time
Share a view, not a table
A view is the contract: you can change the table behind it without breaking recipients.
High Availability and Disaster Recovery
By the end: plan high availability and disaster recovery.
| Term | Meaning |
|---|---|
| RPO | How much data loss you can accept |
| RTO | How long a restore may take |
| Replicate | How |
|---|---|
| Workspace objects (notebooks, jobs, permissions) | Deploy with bundles/Terraform to a dr target |
| Users and groups | Same identity provider, SCIM |
| Unity Catalog objects | Define as code, or recreate from system tables with the SDK |
| Data | Deep clone for managed tables or cloud replication |
| Streaming checkpoints | Keep in storage you can replicate |
- Databricks recommends managed disaster recovery for cross-region DR where available (AWS and Azure). DIY covers what it doesn't
- DR doesn't protect against corruption: bad data replicates too. Use time travel and backups for that
- Test failover regularly: shut down primary, start secondary, repoint BI and clients, and measure
- Plan failback as a maintenance window
%sql
-- deep clone: a full copy you could replicate
CREATE OR REPLACE TABLE orders_dr_copy DEEP CLONE orders
Well-Architected Lakehouse Design
By the end: review a design against the well-architected pillars.
| Pillar | Ask |
|---|---|
| Operational excellence | Can we deploy, monitor and run it repeatably? |
| Security, privacy, compliance | Is data protected and is access least-privilege? |
| Reliability | Does it recover from failures? Is it idempotent? |
| Performance efficiency | Does it scale with load without manual tuning? |
| Cost optimization | Do we pay only for what we use, and see who spends? |
| Data and AI governance | Can we find, trust, and audit data and models? |
| Interoperability and usability | Do open formats and APIs keep it usable by people and other systems? |
Guiding principles (from the docs):
- Curate data and offer trusted data as products
- Eliminate silos and minimise data movement
- Democratise value creation through self-service
- Adopt organisation-wide governance for data and AI
- Encourage open interfaces and open formats
-
Build to scale, optimising for performance and cost
-
Use the pillars as a review checklist at design time and after incidents
- Write down trade-offs you accept (for example latency vs cost)
- Module 22 turns these into a production readiness checklist
What you can do now
- Medallion at scale, batch, streaming, hybrid, Lambda vs Kappa
- CDC lakehouse, data mesh, multi-workspace and multi-cloud designs
- Modelling, open formats, sharing, DR
- The well-architected pillars