def setUp(self): self.session = DBSession() if not self.session.bind: self.session.bind = self.engine transaction.begin()
def _get_db_session(): 'we can call this from scripts to access valid DBSession' # not sure we want to do it this way - but let's use for now session = DBSession() try: session.get_bind() except UnboundExecutionError: session.bind = create_engine('sqlite:///' + _db_file) return session