Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Star Schema #5722

Open
mikeahmarani opened this issue Aug 19, 2024 · 2 comments
Open

Star Schema #5722

mikeahmarani opened this issue Aug 19, 2024 · 2 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request Type: New Diagram

Comments

@mikeahmarani
Copy link

Proposal

Mermaid.js should add star schema support.

Use Cases

A star schema is used to denormalize business data into dimensions (like time and product) and facts (like transactions in amounts and quantities).

Screenshots

image

Syntax

starSchema
	class FactTable {
		product_id: int
		time_id: int
		promotion_id: int
		customer_id: int
		revenue: BigDecimal
		units_sold: int
	}
	class ProductDim {
		product_id: int
		product_name: string
		unit_price: BigDecimal
		product_line: string
	}
	class CustomerDim {
		customer_id: int
		name: string
		city: string
		zip: string
	}
	class TimeDim {
		time_id: int
		order_date: date
		month: int
		quarter: int
		year: int
	}
	class PromotionDim{
		promotion_id: int
		promo_name: string
		ad_type: string
		coupon_type: string
		price_reduction_type: string
	}
	
	FactTable --> ProductDim
	FactTable --> CustomerDim
	FactTable --> TimeDim
	FactTable --> PromotionDim
	
	---- Alternative, Simpler ----
	
starSchema
	FactTable [product_id, time_id, promotion_id, customer_id, revenue, units_sold] --> ProductDim [product_id, product_name, unit_price, product_line]
	FactTable --> TimeDim [time_id, order_date, month, quarter, year]
	FactTable --> CustomerDim [customer_id, name, city, zip]
	FactTable --> PromotionDim [promotion_id, promo_name, ad_type, coupon_type, reduction_type]

Implementation

This is a proposal which I'd love to see built into mermaid by the wonderful community.

@mikeahmarani mikeahmarani added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request Type: New Diagram labels Aug 19, 2024
@tah96
Copy link

tah96 commented Aug 22, 2024

I second this! My team is running into an issue where Star schema would be very helpful

@r-mcmaster-cp
Copy link

Agreed, this would be great to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request Type: New Diagram
Projects
None yet
Development

No branches or pull requests

3 participants