Building a Loading and Transformation analytics layer in an Ecommerce Company using Snowflake and dbt.
This project implements a production-grade analytics platform for the Brazilian Olist ecommerce dataset using Snowflake and dbt. The goal is to transform raw transactional data into trusted, analytics-ready marts that answer key business questions around customers, products, sellers, payments, and reviews.
Olist is a Brazilian ecommerce platform that connects small businesses to marketplaces.
The dataset contains information about:
- Customers and locations
- Orders and order lifecycle
- Order items and products
- Sellers and seller locations
- Payments and installments
- Customer reviews
- Geolocation (ZIP-code level)
| Layer | Technology |
|---|---|
| Cloud Data Warehouse | Snowflake |
| Transformation | dbt |
| Modeling | Kimball-style star schema |
| Data Quality | dbt tests |
| Documentation | dbt docs |
The RAW schema contains unmodified data loaded directly from source files. These tables represent the system of record and are never transformed directly.
customersgeolocationordersorder_itemsorder_paymentsorder_reviewsproductssellers
Key Principle: No business logic is applied in the RAW layer.
dbt/ecommerce/
│
├── models/
│ ├── staging/
│ ├── intermediate/
│ ├── dimensions/
│ ├── marts/
│
├── snapshots/
├── tests/
│ ├── singular/
│ ├── generic/
│
├── macros/
├── dbt_project.yml
└── README.md
- One-to-one mapping with RAW tables
- Column selection and renaming
- Type casting and basic cleanup
- No joins
stg_customersstg_ordersstg_order_itemsstg_order_paymentsstg_order_reviewsstg_productsstg_sellersstg_geolocation
These models form the foundation of all downstream transformations.
- Apply business logic
- Perform joins across domains
- Resolve many-to-many relationships
- Prepare data for dimensional modeling
| Model | Description |
|---|---|
int_order_items |
Orders joined with order items |
int_order_items_payments |
Orders + items + payments |
int_order_items_reviews |
Orders + items + reviews |
This layer prevents logic duplication in marts.
- Describe business entities
- Support slicing and filtering in BI tools
- Used as lookup tables in marts
| Dimension | Description |
|---|---|
dim_customer_locations |
Customers enriched with geolocation |
dim_products |
Product attributes |
dim_seller_locations |
Sellers enriched with geolocation |
Dimensions are incremental and snapshot-ready.
- Analytics- and BI-ready fact tables
- Clear grain definitions
- Optimized for querying and dashboards
| Mart | Grain | Business Use Case |
|---|---|---|
mrt_customer_order_items |
Customer × Order × Product | Purchase behavior |
mrt_customer_order_items_reviews |
Customer × Order × Product × Review | Customer satisfaction |
mrt_customer_order_payments |
Order × Payment | Payment behavior |
mrt_order_product_items |
Order × Product | Product performance |
mrt_seller_order_items |
Seller × Order × Product | Seller performance |
This analytics stack enables answers to critical ecommerce questions:
- Who are the most valuable customers?
- How does customer location impact delivery time?
- How do customer reviews correlate with repeat purchases?
- Which product categories generate the most revenue?
- What products receive the highest and lowest reviews?
- How do shipping costs vary by product size and weight?
- Which sellers generate the highest revenue?
- Which sellers have the fastest delivery times?
- How does seller location affect fulfillment performance?
- What payment methods are most commonly used?
- How often do customers pay in installments?
- What is the average order value by payment type?
- How do delivery delays impact review scores?
- Which products or sellers receive poor reviews?
- What factors drive 5-star reviews?
All tests are defined in the /tests folder.
- Singular tests (business rules, joins, anomalies)
- No negative prices or freight values
- Valid order statuses
- Enforced primary and foreign keys
Tests fail if any invalid rows are returned.
Snapshots track historical changes to dimension attributes.
snap_customersnap_seller
Tracked attributes include:
- City
- State
- ZIP code
Enables historical analysis such as "Where was the customer located at the time of purchase?"
Reusable SQL logic is centralized in macros.
generate_schema_name
Improves consistency and reduces duplication.
- All models and columns are documented
- Full lineage available via
dbt docs - Exposures connect marts to BI dashboards
dbt docs generate
dbt docs serve- Incremental models with
mergestrategy - Defined
unique_keyper model - Optimized for large-scale ecommerce datasets
Designed to scale with growing order volumes.
- Metrics layer (AOV, CLV, retention)
- Cohort analysis models
- Seller SLA scoring
- Customer lifetime value modeling
- Feature store for ML use cases
Contributions are welcome!
-
Create a feature branch
git checkout -b feature/xyz
-
Commit changes
git commit -m "Add xyz feature" -
Push to branch
git push origin feature/xyz
-
Open a Pull Request.

