def new_session_factory(url="sqlite:///:memory:", reset=False, **kwargs):
    if url.startswith('sqlite'):
        kwargs.setdefault('connect_args', {'check_same_thread': False})
    elif url.startswith('mysql'):
        kwargs.setdefault('pool_recycle', 60)

    if url.endswith(':memory:'):
        # If we're using an in-memory database, ensure that only one connection
        # is ever created.
        kwargs.setdefault('poolclass', StaticPool)

    engine = create_engine(url, **kwargs)
    if reset:
        Base.metadata.drop_all(engine)
    Base.metadata.create_all(engine)

    session_factory = sessionmaker(bind=engine)
    return session_factory
Displays a generic menu.
dataset/ETHPy150Open jupyterhub/jupyterhub/jupyterhub/orm.py/new_session_factory--crossover with--dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/interfaces.py/IDisplay.menu