Started work on db connection
This commit is contained in:
parent
eac85c6bfe
commit
7318c6c81b
2 changed files with 15 additions and 1 deletions
|
|
@ -1,4 +1,7 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
ROOT_PATH = project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
ROOT_PATH = project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||||
ICONS_PATH = f"{ROOT_PATH}/icons"
|
ICONS_PATH = f"{ROOT_PATH}/icons"
|
||||||
|
|
||||||
|
DATABASE_FILE_PROJECT_PATH = f"/db/database.db"
|
||||||
|
SQLITE_URL = f"sqlite://{DATABASE_FILE_PROJECT_PATH}"
|
||||||
11
src/modules/db_connection.py
Normal file
11
src/modules/db_connection.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
from sqlmodel import create_engine
|
||||||
|
from src.config import definitions
|
||||||
|
|
||||||
|
|
||||||
|
sqlite_url = definitions.SQLITE_URL
|
||||||
|
|
||||||
|
connect_args = {"check_same_thread": False}
|
||||||
|
engine = create_engine(sqlite_url, echo=False, connect_args=connect_args)
|
||||||
|
|
||||||
|
def get_engine():
|
||||||
|
return engine
|
||||||
Loading…
Reference in a new issue