# ojaswip2828/de-sql-pipeline architecture

> Architecture diagram of the GitHub repository ojaswip2828/de-sql-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ojaswip2828/de-sql-pipeline
- Repository: https://github.com/ojaswip2828/de-sql-pipeline

## Overview

This repository is a PostgreSQL batch-warehouse learning project, implemented in a single notebook. Its main workflow lands CSV/JSONL data in staging, cleans and validates it, maintains customer and product dimensions, and loads partitioned sales facts; a stored procedure and audit tables support repeatable runs. The README also documents event JSON processing, customer-LTV serving, reconciliation, and performance analysis. No notebook source was provided, so relationships below are limited to those explicitly shown in the README architecture and capability descriptions.

Main entry points: [`Week6_DE_SQL_Pipeline.ipynb`](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb) (Text staging tables)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion and staging"]
  node_staging[("Text staging tables")]
  node_rejects[("Sales rejects")]
end

subgraph group_warehouse["Warehouse data"]
  node_customers[("Customer dimension")]
  node_products[("Product dimension")]
  node_sales_fact[("Partitioned sales fact")]
  node_events[("Partitioned events")]
  node_ltv[("Customer LTV")]
end

subgraph group_operations["Load operations"]
  node_load_proc["Sales load procedure"]
  node_change_audit[("Dimension change audit")]
  node_run_audit[("Pipeline run audit")]
end

subgraph group_analysis["Analysis and quality"]
  node_reconciliation["Reconciliation checks"]
  node_performance["Query performance analysis"]
end

node_files["CSV / JSONL files"]

node_files -->|"COPY loads"| node_staging
node_staging -->|"routes invalid rows"| node_rejects
node_staging -->|"merges history"| node_customers
node_staging -->|"upserts changes"| node_products
node_staging -->|"loads sales"| node_sales_fact
node_staging -->|"loads events"| node_events
node_sales_fact -->|"serves LTV"| node_ltv
node_customers -.->|"trigger audits"| node_change_audit
node_load_proc -.->|"runs batch load"| node_sales_fact
node_load_proc -.->|"logs run"| node_run_audit
node_staging -.->|"checks row counts"| node_reconciliation
node_sales_fact -.->|"analyzes queries"| node_performance

click node_staging "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_rejects "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_load_proc "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_customers "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_products "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_sales_fact "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_events "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_ltv "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_change_audit "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_run_audit "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_reconciliation "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"
click node_performance "https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_staging,node_rejects toneBlue
class node_customers,node_products,node_sales_fact,node_events,node_ltv toneAmber
class node_load_proc,node_change_audit,node_run_audit toneMint
class node_reconciliation,node_performance toneRose
class node_files toneIndigo
```

## Components

### Ingestion and staging

- [Text staging tables](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`
- [Sales rejects](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`

### Warehouse data

- [Customer dimension](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`
- [Product dimension](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`
- [Partitioned sales fact](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`
- [Partitioned events](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`
- [Customer LTV](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`

### Load operations

- [Sales load procedure](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`
- [Dimension change audit](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`
- [Pipeline run audit](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`

### Analysis and quality

- [Reconciliation checks](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`
- [Query performance analysis](https://github.com/ojaswip2828/de-sql-pipeline/blob/main/Week6_DE_SQL_Pipeline.ipynb): `Week6_DE_SQL_Pipeline.ipynb`

### Other components

- **CSV / JSONL files**

## Connections

- CSV / JSONL files → Text staging tables: COPY loads (evidence: `README.md`)
- Text staging tables → Sales rejects: routes invalid rows (evidence: `README.md`)
- Text staging tables → Customer dimension: merges history (evidence: `README.md`)
- Text staging tables → Product dimension: upserts changes (evidence: `README.md`)
- Text staging tables → Partitioned sales fact: loads sales (evidence: `README.md`)
- Text staging tables → Partitioned events: loads events (evidence: `README.md`)
- Partitioned sales fact → Customer LTV: serves LTV (evidence: `README.md`)
- Customer dimension → Dimension change audit: trigger audits (evidence: `README.md`)
- Sales load procedure → Partitioned sales fact: runs batch load (evidence: `README.md`)
- Sales load procedure → Pipeline run audit: logs run (evidence: `README.md`)
- Text staging tables → Reconciliation checks: checks row counts (evidence: `README.md`)
- Partitioned sales fact → Query performance analysis: analyzes queries (evidence: `README.md`)
