(SQLAlchemy 1.0.11)
I'm trying to figure out how to define a unique constraint from within the
model when using declarative_base.
class User(Base):
__tablename__ = 'users'
# This obviously doesn't work
__table_args__ = (
UniqueConstraint("data->'email'")
)
data =
I think you might want to use the lightweight sqlalchemy.column()
(lowercase!) expression; UniqueConstraint(sa.column('data',
JSON)['email']) might work.
On 12/30/15 5:58 PM, Andrew Muro wrote:
(SQLAlchemy 1.0.11)
I'm trying to figure out how to define a unique constraint from within
the