SAP Data Doesn’t Care About Your Medallion (And I Built One Anyway)

· Source: Data Engineering on Medium · Field: Technology & Digital — Data Science & Analytics, Artificial Intelligence & Machine Learning · Depth: Intermediate, long

Summary

This article details the implementation of a Medallion architecture for processing complex SAP data within Databricks, utilizing Lakeflow Declarative Pipelines. It addresses common challenges with raw SAP data, such as non-standard date formats like CHAR(16) and "0000-00-00" values, FLOAT types for monetary amounts, and obscure column names like VBELN. The architecture comprises a bronze layer, automatically synced by OneConnect with Change Data Feed enabled; a silver layer that performs Change Data Capture (CDC) to maintain Type-1 snapshots and correctly propagate deletes; and a gold layer that enriches data with text tables, derives calculated fields, and renames technical terms to business-friendly language. A crucial design choice involves separating the generic silver pipeline from domain-specific gold pipelines to ensure data governance and prevent pipeline collisions.

Key takeaway

For data engineers building robust data platforms with SAP sources, you should adopt a multi-pipeline Medallion architecture. This approach, using Lakeflow Declarative Pipelines, ensures proper handling of SAP's complex data types and critical delete propagation. Separate your generic silver layer from domain-specific gold layers to prevent conflicts and maintain data integrity. This strategy provides clean, governed data essential for trustworthy dashboards and advanced AI applications like text-to-SQL agents.

Key insights

Taming chaotic SAP data requires a declarative pipeline approach with careful handling of data types and deletes.

Principles

Method

Implement a Medallion architecture: Bronze (raw, CDC-enabled), Silver (Type-1 snapshot, apply_as_deletes for CDC), Gold (enrichment, renaming, type casting). Use two pipelines: one for silver, multiple for gold.

In practice

Topics

Code references

Best for: Data Engineer, MLOps Engineer, AI Architect

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Data Engineering on Medium.