What is the good approach to check an existance of unique values in database table by SqlAlchemy in python2.7
问题 I use session.merge in SqlAlchemy to insert data to the table with UniqueConstraint , which is common for several columns, for example, my ORM class has the following: UniqueConstraint("attr_1", "attr_2", "attr_3", name="attributes_uix") Should I use filter or filter_by with _and to check, if data, which I'm going to insert will violate this unique constraint, or is it the proper way to catch IntegrityError by try - except construction? 回答1: No an sql-alchemy expert but have struggled with