Exemplo n.º 1
0
    def save(self):

        try:
            db.session.add(self)
            db.session.commit()
        except (exc.IntegrityError, exc.InvalidRequestError):
            db.session().rollback()
Exemplo n.º 2
0
 def save(self):
     try:
         db.session.add(self)
         db.session.commit()
     except SQLAlchemyError as error:
         db.session().rollback()
         raise error