<s> from sqlalchemy import create_engine <EOL> from sqlalchemy . orm import sessionmaker <EOL> def get_session ( app ) : <EOL> if not hasattr ( app , '<STR_LIT>' ) : <EOL> engine = create_engine ( app . config . get ( '<STR_LIT>' ) , <EOL> convert_unicode = True ) <EOL> Session = sessionmaker ( bind = engine , autocommit = False , autoflush = False ) <EOL> app . db_session = Session ( ) <EOL> return app . db_session </s>
