Databricks Medallion Architecture: Data Modeling Guide, Best practices, Standards, Examples

  Hello Data Pros, and welcome back to another exciting blog in our Databricks learning series! In our last blog, we explored various platform architectures, specifically focusing on the modern Data Lakehouse architecture and its implementation using the Delta Lake framework. But today, we're moving to the next big question: With this powerful platform architecture in place, how do we organize and model our data effectively? And that’s where the Medallion Architecture comes in! So, what exactly is Medallion Architecture? It’s a data design pattern, developed to logically structure and organize your data within a Lakehouse! Its main purpose is to progressively improve the quality and usability of your data, as it moves through different stages, such as Bronze, Silver, and Gold. Think of it as a transformation journey, where raw data is refined step by step into a polished and analysis-ready state! Some people call it a multi-hop architecture because the data flows through several tr...

Macros in dbt | Data Build Tool | Jinja and macros tutorial

 



oms_dbt_proj\macros\oms_common.sql

{% macro to_celsius(fahrenheit_column, decimal_places=1) %}
  ROUND(({{ fahrenheit_column }} - 32) * 5/9, {{ decimal_places }})
{% endmacro %}

{% macro generate_profit_model(table_name) %}
SELECT
  sales_date,
  SUM(quantity_sold * unit_sell_price) as total_revenue,
  SUM(quantity_sold * unit_purchase_cost) as total_cost,
  SUM(quantity_sold * unit_sell_price) - SUM(quantity_sold * unit_purchase_cost) as total_profit
FROM {{ source('training', table_name) }}
GROUP BY sales_date
{% endmacro %}


oms_dbt_proj\models\profit_uk.sql

{{ generate_profit_model('sales_uk') }}









Comments

Popular posts from this blog

How to Install Airflow on Windows

How to Install DBT and Set Up a Project, Create Your First dbt Model

Airflow DAGs, Operators, Tasks & Providers