def save(self): session = get_session() try: session.add(self) session.commit() except IntegrityError: session.rollback()
def save(self): yield from asyncio.sleep(1.0) session = get_session() try: session.add(self) session.commit() except IntegrityError: session.rollback()
def get(cls, search_string): session = get_session() return session.query(Page).\ filter("pages.content @@ to_tsquery(:search_string)").\ params(search_string=search_string).all()