Compare commits
2 Commits
bf3bd1b147
...
bd7c590646
| Author | SHA1 | Date | |
|---|---|---|---|
| bd7c590646 | |||
| 764078562a |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -194,4 +194,5 @@ cython_debug/
|
|||||||
.cursorindexingignore
|
.cursorindexingignore
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
output/*
|
output/*
|
||||||
|
.vscode/settings.json
|
||||||
|
|||||||
@@ -6,4 +6,6 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
VOLUME ["/etl/logs"]
|
||||||
|
|
||||||
CMD ["python3", "./src/load.py"]
|
CMD ["python3", "./src/load.py"]
|
||||||
@@ -42,7 +42,7 @@ match the column names of the database schema.
|
|||||||
|
|
||||||
## load.py
|
## load.py
|
||||||
Takes the JSON file created by transform.py and loads the data into a PostgreSQL database for
|
Takes the JSON file created by transform.py and loads the data into a PostgreSQL database for
|
||||||
retreival later.
|
retrieval later.
|
||||||
|
|
||||||
## orchestrator.py
|
## orchestrator.py
|
||||||
Handles the orchestration of each program being ran one after the other. Ensures each
|
Handles the orchestration of each program being ran one after the other. Ensures each
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ services:
|
|||||||
expose:
|
expose:
|
||||||
- "5432"
|
- "5432"
|
||||||
ports:
|
ports:
|
||||||
- "8081:5432"
|
- "5432:5432"
|
||||||
shm_size: 128mb
|
shm_size: 128mb
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||||
@@ -36,9 +36,7 @@ services:
|
|||||||
command: "python3 ./src/orchestrator.py"
|
command: "python3 ./src/orchestrator.py"
|
||||||
restart: no
|
restart: no
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/etl
|
- /tmp/etl/logs/:/var/lib/etl/logs
|
||||||
pre_stop:
|
|
||||||
- command: docker cp CONTAINER:/var/lib/etl/lms-etl.log /tmp/app_logs
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ def load_transformed_books(cursor, books):
|
|||||||
`collection_item` SQL table
|
`collection_item` SQL table
|
||||||
'''
|
'''
|
||||||
for book in books['books']:
|
for book in books['books']:
|
||||||
# This for i in range statment simulates a library buying multiple copies of a book.
|
# This for i in range statement simulates a library buying multiple copies of a book.
|
||||||
try:
|
try:
|
||||||
for i in range(random.randrange(1, 10)):
|
for i in range(random.randrange(1, 10)):
|
||||||
cursor.execute(sql_statements.collection_insert_statement(book))
|
cursor.execute(sql_statements.collection_insert_statement(book))
|
||||||
|
|||||||
Reference in New Issue
Block a user