From 2c59052ed697c382f36ba60ec6df2bb401f8bce0 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 18 Mar 2022 09:16:01 +0100 Subject: [PATCH] #3 --- datenbank.py => database.py | 0 json_reader.py | 1 + main.py | 27 +++++++++++++--- questions_answer.json | 63 +++++++++++++++++++++++++++++++++++++ questions_awnsers.json | 0 5 files changed, 87 insertions(+), 4 deletions(-) rename datenbank.py => database.py (100%) create mode 100644 json_reader.py create mode 100644 questions_answer.json delete mode 100644 questions_awnsers.json diff --git a/datenbank.py b/database.py similarity index 100% rename from datenbank.py rename to database.py diff --git a/json_reader.py b/json_reader.py new file mode 100644 index 0000000..ff01c9b --- /dev/null +++ b/json_reader.py @@ -0,0 +1 @@ +# TODO: einlsen der berreits vorhanden Daten im JSON File \ No newline at end of file diff --git a/main.py b/main.py index b9085fc..030d4b0 100644 --- a/main.py +++ b/main.py @@ -4,15 +4,34 @@ import config import database_connection +import database + +cursor = database_connection.db_connection(config.user, config.password, config.host) -def menue(): +def menu(): + enable_menu = True + selection = {1: 'Datenbank erstellen', 2: 'Datenbank löschen', 3: 'Datenbank umbenennen', 4: 'Datenbank auselsen', + 5: 'Tabelle erstellen'} # TODO Menü erstellen - return + + print('Was möchtest du tun?') + while enable_menu: + for key, value in selection.items(): + print(key, value) + selection_number = int(input('Bitte Auswahl treffen')) + + match selection_number: + case 1: + print('Datenbank erstellen') # Platzhalter für die Funktion + database.create_database(cursor) + case 2: + print('Datenbank löschen') # Platzhalter für die Funktion + break def main(): - database_connection.db_connection(config.user, config.password, config.host) + menu() -main() \ No newline at end of file +main() diff --git a/questions_answer.json b/questions_answer.json new file mode 100644 index 0000000..4f092a5 --- /dev/null +++ b/questions_answer.json @@ -0,0 +1,63 @@ +[ + { + "#1": { + "question": " ", + "answer": " " + } + }, + { + "#2": { + "question": " ", + "answer": " " + } + }, + { + "#3": { + "question": " ", + "answer": " " + } + }, + { + "#4": { + "question": " ", + "answer": " " + } + }, + { + "#5": { + "question": " ", + "answer": " " + } + }, + { + "#6": { + "question": " ", + "answer": " " + } + }, + { + "#7": { + "question": " ", + "answer": " " + } + }, + { + "#8": { + "question": " ", + "answer": " " + } + }, + { + "#9": { + "question": " ", + "answer": " " + } + }, + { + "#10": { + "question": " ", + "answer": " " + } + } + +] \ No newline at end of file diff --git a/questions_awnsers.json b/questions_awnsers.json deleted file mode 100644 index e69de29..0000000