diff --git a/backend/__init__.py b/backend/__init__.py index ffd8949..4f75637 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -1,9 +1,11 @@ #!/usr/bin/env python3 -from .database import db import os -from dotenv import load_dotenv import time +from dotenv import load_dotenv + +from .database import db + async def startup(): load_dotenv() @@ -12,6 +14,6 @@ async def startup(): await db.use("lf5", "lf5") await db.query('DEFINE TABLE kunde SCHEMAFULL') await db.query('DEFINE FIELD kundenNr ON TABLE kunde TYPE string') - while(True): + while True: print(await db.query('SELECT * FROM kunde')) - time.sleep(5) \ No newline at end of file + time.sleep(5) diff --git a/backend/database.py b/backend/database.py index c6ec188..417cd56 100644 --- a/backend/database.py +++ b/backend/database.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 import os -from surrealdb import Surreal + from dotenv import load_dotenv +from surrealdb import Surreal load_dotenv() db = Surreal(f"ws://{os.environ.get('DB_HOST')}:{os.environ.get('DB_PORT')}/rpc") -# TODO: "SQL"-Prompts \ No newline at end of file +# TODO: "SQL"-Prompts diff --git a/run.py b/run.py index 8eb8c53..e677aca 100644 --- a/run.py +++ b/run.py @@ -1,8 +1,7 @@ #!/usr/bin/env python3 +import asyncio + from backend import startup -import asyncio -import os - if __name__ == "__main__": - asyncio.run(startup()) \ No newline at end of file + asyncio.run(startup())