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