我有一个模特:
calendar = Table('calendar', metadata,
Column('id', Integer, primary_key=True),
Column('event_name', String),
Column('start_time', DateTime(timezone=True)),
Column('end_time', DateTime(timezone=True)),
Column("created_by_id", Integer, ForeignKey("users.id")),
Column('bool_applicable_to_all', Boolean),
Column('bool_leave', Boolean),
UniqueConstraint('event_name','start_time', name="uniq_event_nm_start_time"),
CheckConstraint('bool_applicable_to_all' != 'bool_leave', name='bool_all_applicable_bool_leave_not_together'
))
如何确保在任何时间点,在checkconstraint中定义的2列具有相反的布尔值? 使用sqlalchemy 1.0,PostgreSQL 9.5 +