Is there a way to create a table with postgresql exception restriction in Alembic without writing an SQL literal?
Consider, for example, this table:
CREATE TABLE reservation ( during tsrange, EXCLUDE USING gist (during WITH &&) );
Exception constraints do not seem to be among the available types of constraints in alembic.
Because SQLAlchemy supports ExcludeConstraints
from sqlalchemy.dialects.postgresql import ExcludeConstraint, TSRANGE class RoomBooking(Base): __tablename__ = 'room_booking' room = Column(Integer(), primary_key=True) during = Column(TSRANGE()) __table_args__ = ( ExcludeConstraint(('room', '='), ('during', '&&')), )
but alembic doesn't seem to recognize them, I wonder if there are other ways to reflect such exclusion restrictions in my history of schema changes.
source share