19 lines
494 B
Python
19 lines
494 B
Python
import os
|
|
|
|
from surrealdb import Surreal
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
async def Database():
|
|
load_dotenv()
|
|
db = Surreal(f"ws://{os.environ.get('DB_HOST')}:{os.environ.get('DB_PORT')}/rpc")
|
|
await db.signin({"user": os.environ.get('DB_USER'), "pass": os.environ.get('DB_PW')})
|
|
await db.use("lf5", "krautundrueben")
|
|
return db
|
|
|
|
|
|
async def load_init_data():
|
|
db = await Database()
|
|
query = open('../data/data.surrealql', 'r').read()
|
|
await db.query(query)
|
|
return
|