def test_session(db): db.create_all() # basic session usage user = User(name="bill") session = Session() session.add(user) session.commit() session.close()
def session(): db_session = Session() db_session.begin_nested() yield db_session db_session.rollback()
def get_session(cls): from starlette_core.database import Session return Session()
def session(database): sess = Session() yield sess database.truncate_all()
def session(): db_session = Session() yield db_session db.truncate_all(True)
def session_initialized(request): Session() has_session = get_request_id() in Session.registry.registry return JSONResponse({"has_session": has_session, "id": get_request_id()})
def session(): db_session = Session() yield db_session Session.remove() db.truncate_all()