I have a very simple SqlAlchemy model
class User(Base):
    """ The SQLAlchemy declarative model class for a User object. """
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    phone = Column(String, unique=True)
    email = Column(String, unique=True)
When inserting a new User, an IntegrityError could occur if the email or phone is a duplicate. 
Is there any way to detect which of the columns was violating the integrity error? Or is the only way to do a separate query to see or a value is present?
 
     
     
     
     
     
    