Add a cli interface to choose a configuration (#163)

- [x] add a cli to the webserver to take env variables into account 
- [x] add a cli to the data processing that takes enviromental variable
as a valid source into account
- [x] rework the cli for the reset sql command
- [x] rework the cli for the copying of sql data from one db to another
This commit is contained in:
2023-10-02 20:31:42 +02:00
committed by GitHub
parent 2abe12f027
commit d2d4a436f8
22 changed files with 650 additions and 304 deletions

View File

@ -7,11 +7,15 @@ from typing import Any
import pytest
from sqlalchemy.engine import Engine
from sqlalchemy.orm import Session
from sqlalchemy.orm import Session, sessionmaker
from aki_prj23_transparenzregister.config.config_template import SQLiteConnectionString
from aki_prj23_transparenzregister.utils import data_transfer
from aki_prj23_transparenzregister.utils.sql import entities
from aki_prj23_transparenzregister.utils.sql.connector import get_session, init_db
from aki_prj23_transparenzregister.utils.sql.connector import (
get_engine,
init_db,
)
@pytest.fixture(autouse=True)
@ -39,7 +43,11 @@ def empty_db() -> Generator[Session, None, None]:
"""Generates a db Session to a sql_lite db."""
if os.path.exists("test-db.db"):
os.remove("test-db.db")
db = get_session("sqlite:///test-db.db")
db = sessionmaker(
autocommit=False,
autoflush=False,
bind=get_engine(SQLiteConnectionString("test-db.db")),
)()
init_db(db)
yield db
db.close()