Unique if not null SQLAlchemy and Django Unique if not null SQLAlchemy and Django django django

Unique if not null SQLAlchemy and Django


Multiple rows with NULL values should not be a problem for the unique constraint. Only "values" must be unique, NULL is no value.

Have you tried?:

upc = Column(String(), unique=True, nullable=True)