Generation

typingsThu, 27 Apr 2023

from sqlalchemy import URL, create_engine from sqlalchemy.orm import sessionmaker from app.utils import get_config config = get_config() db_url = URL.create( "oracle+oracledb", username=config["ORACLE"]["USERNAME"], password=config["ORACLE"]["PASSWORD"], host=config["ORACLE"]["HOST"], port=config["ORACLE"]["PORT"], query={"service_name": config["ORACLE"]["SERVICE_NAME"]}, ) engine = create_engine( db_url, label_length=5, pool_size=20, max_overflow=10, pool_pre_ping=True, # echo=True, # echo_pool="debug" ) session = sessionmaker(autocommit=False, autoflush=False, bind=engine) def db_session(): with session() as db: yield db

typings for: from sqlalchemy import URL, create_engine from sqlalchemy.orm import sessionmaker from typing import ContextManager from app.utils import get_config config = get_config() db_url: URL db_url = URL.create( "oracle+oracledb", username=config["ORACLE"]["USERNAME"], password=config["ORACLE"]["PASSWORD"], host=config["ORACLE"]["HOST"], port=config["ORACLE"]["PORT"], query={"service_name": config["ORACLE"]["SERVICE_NAME"]}, ) engine: Engine engine = create_engine( db_url, label_length=5, pool_size=20, max_overflow=10, pool_pre_ping=True, # echo=True, # echo_pool="debug" ) session: sessionmaker session = sessionmaker(aut

Questions about programming?Chat with your personal AI assistant