

def get_session(self, session_name):
    'SQLAlchemy session getter.'
    if (session_name not in self._sessions):
        try:
            conf = self.config['sessions'][session_name]
        except KeyError:
            raise KitError(('No session %r found' % (session_name,)))
        engine = create_engine(conf.get('url', 'sqlite://'), **conf.get('engine', {
            
        }))
        session = scoped_session(sessionmaker(bind=engine, **conf.get('kwargs', {
            
        })))
        options = conf.get('options', {
            
        })
        options.setdefault('commit', False)
        options.setdefault('raise', True)
        self._sessions[session_name] = (session, options)
    return self._sessions[session_name][0]

dataset/ETHPy150Open mtth/kit/kit/base.py Kit.get_session/original