-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdimensional_model.er
48 lines (42 loc) · 1.55 KB
/
dimensional_model.er
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
title {label: "Sparkify Dimensional Data Model (RedShift Implementation)", size: "20"}
[songplay] {bgcolor: "#ececfc"}
*songplay_id {label: "BIGINT, IDENTITY(0,1), PRIMARY KEY"}
+start_time {label: "TIMESTAMP, NOT NULL"}
+user_id {label: "INT, NOT NULL"}
level {label: "VARCHAR, NULL"}
+song_id {label: "VARCHAR, NULL, DISTKEY, SORTKEY"}
+artist_id {label: "INT, NULL"}
session_id {label: "INT, NULL"}
location {label: "VARCHAR, NULL"}
user_agent {label: "VARCHAR, NULL"}
[time] {bgcolor: "#d0e0d0"}
*start_time {label: "TIMESTAMP, PRIMARY KEY"}
hour {label: "SMALLINT, NOT NULL"}
day {label: "SMALLINT, NOT NULL"}
week {label: "SMALLINT, NOT NULL"}
month {label: "SMALLINT, NOT NULL"}
year {label: "SMALLINT, NOT NULL"}
weekday {label: "SMALLINT, NOT NULL"}
[users] {bgcolor: "#d0e0d0"}
*user_id {label: "INT, PRIMARY KEY"}
first_name {label: "VARCHAR, NOT NULL"}
last_name {label: "VARCHAR, NOT NULL"}
gender {label: "CHAR(1), NULL"}
level {label: "VARCHAR, NULL"}
[songs] {bgcolor: "#d0e0d0"}
*song_id {label: "VARCHAR, PRIMARY KEY, DISTKEY"}
title {label: "VARCHAR, NOT NULL"}
+artist_id {label: "VARCHAR, NOT NULL"}
year {label: "SMALLINT, NOT NULL"}
duration {label: "REAL, NULL"}
[artists] {bgcolor: "#d0e0d0", label: "diststyle all"}
*artist_id {label: "VARCHAR, PRIMARY KEY"}
name {label: "VARCHAR, NOT NULL"}
location {label: "VARCHAR, NULL"}
latitude {label: "REAL, NULL"}
longitude {label: "REAL, NULL"}
songplay *--1 time
songplay *--1 users
songplay *--1 artists
songplay *--1 songs
artists 1--* songs