Skip to content

Commit 9fb84ec

Browse files
Import data every time (#2)
* Include the dataset * fix the dataset * use chinook-postgres DDL * Import data from the files * do not replace table * add missing import * fix import data.py * sort files * import data in a fixed order * fix file order again
1 parent b03e38e commit 9fb84ec

File tree

15 files changed

+59316
-15627
lines changed

15 files changed

+59316
-15627
lines changed

.github/workflows/pr-test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ jobs:
1818
- name: Setup Docker
1919
uses: docker/setup-buildx-action@v3
2020

21+
- name: Setup Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.10'
25+
26+
- name: Install Python Dependencies
27+
run: |
28+
pip install psycopg2-binary pandas sqlalchemy
29+
2130
- name: Start PostgreSQL
2231
working-directory: static/relational/postgres
2332
run: |
@@ -29,6 +38,15 @@ jobs:
2938
sleep 2
3039
done
3140
41+
- name: Load Data into PostgreSQL
42+
working-directory: static/relational/postgres
43+
run: |
44+
python import-data.py ../../../relational/dataset \
45+
--database postgres \
46+
--user postgres \
47+
--port 5433 \
48+
--password postgres
49+
3250
- name: Setup NDC Postgres
3351
working-directory: static/relational/postgres
3452
env:

relational/dataset/001_MediaType.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{
3+
"MediaTypeId": 1,
4+
"Name": "MPEG audio file"
5+
},
6+
{
7+
"MediaTypeId": 2,
8+
"Name": "Protected AAC audio file"
9+
},
10+
{
11+
"MediaTypeId": 3,
12+
"Name": "Protected MPEG-4 video file"
13+
},
14+
{
15+
"MediaTypeId": 4,
16+
"Name": "Purchased AAC audio file"
17+
},
18+
{
19+
"MediaTypeId": 5,
20+
"Name": "AAC audio file"
21+
}
22+
]

relational/dataset/002_Genre.json

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
[
2+
{
3+
"GenreId": 1,
4+
"Name": "Rock"
5+
},
6+
{
7+
"GenreId": 2,
8+
"Name": "Jazz"
9+
},
10+
{
11+
"GenreId": 3,
12+
"Name": "Metal"
13+
},
14+
{
15+
"GenreId": 4,
16+
"Name": "Alternative & Punk"
17+
},
18+
{
19+
"GenreId": 5,
20+
"Name": "Rock And Roll"
21+
},
22+
{
23+
"GenreId": 6,
24+
"Name": "Blues"
25+
},
26+
{
27+
"GenreId": 7,
28+
"Name": "Latin"
29+
},
30+
{
31+
"GenreId": 8,
32+
"Name": "Reggae"
33+
},
34+
{
35+
"GenreId": 9,
36+
"Name": "Pop"
37+
},
38+
{
39+
"GenreId": 10,
40+
"Name": "Soundtrack"
41+
},
42+
{
43+
"GenreId": 11,
44+
"Name": "Bossa Nova"
45+
},
46+
{
47+
"GenreId": 12,
48+
"Name": "Easy Listening"
49+
},
50+
{
51+
"GenreId": 13,
52+
"Name": "Heavy Metal"
53+
},
54+
{
55+
"GenreId": 14,
56+
"Name": "R&B/Soul"
57+
},
58+
{
59+
"GenreId": 15,
60+
"Name": "Electronica/Dance"
61+
},
62+
{
63+
"GenreId": 16,
64+
"Name": "World"
65+
},
66+
{
67+
"GenreId": 17,
68+
"Name": "Hip Hop/Rap"
69+
},
70+
{
71+
"GenreId": 18,
72+
"Name": "Science Fiction"
73+
},
74+
{
75+
"GenreId": 19,
76+
"Name": "TV Shows"
77+
},
78+
{
79+
"GenreId": 20,
80+
"Name": "Sci Fi & Fantasy"
81+
},
82+
{
83+
"GenreId": 21,
84+
"Name": "Drama"
85+
},
86+
{
87+
"GenreId": 22,
88+
"Name": "Comedy"
89+
},
90+
{
91+
"GenreId": 23,
92+
"Name": "Alternative"
93+
},
94+
{
95+
"GenreId": 24,
96+
"Name": "Classical"
97+
},
98+
{
99+
"GenreId": 25,
100+
"Name": "Opera"
101+
}
102+
]

0 commit comments

Comments
 (0)