def get_session(db_path: str):
    """ Creates and opens a database session """
    # cfg = Config()
    # db_path = cfg.get(ConfigKeys.asset_allocation_database_path)

    # connection
    con_str = "sqlite:///" + db_path
    # Display all SQLite info with echo.
    engine = create_engine(con_str, echo=False)

    # create metadata (?)
    Base.metadata.create_all(engine)

    # create session
    Session = sessionmaker(bind=engine)
    session = Session()

    return session
def get_session ( db_path : str ) : con_str = "sqlite:///" + db_path engine = create_engine ( con_str , echo = False ) Base . metadata . create_all ( engine ) Session = sessionmaker ( bind = engine ) session = Session ( ) return session
Creates and opens a database session