(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
Mike,
Would you be interested in a pull request to add a Query and/or
Session option for this?
My use case right now is putting the query in a registry so other
callables down the line can refine the search criteria, but I may
well not being alone in