I did something like this with
class Document():
__module__ = __name__
__tablename__ = 'documents'
__table_args__ = (UniqueConstraint('number', 'date'), {} )
id = Column(... ...)
But you need to go a step further to link this to year rather than
date - perhaps you need to have a new column 'year'
Hope this helps
Merv
On Oct 2, 5:04 pm, Joril <[email protected]> wrote:
> On 2 Ott, 10:42, Joril <[email protected]> wrote:
>
> > I have a class "Document" with attributes "Number" and "Date", is
> > there a way to set a UniqueConstraint on "Number + year(Date)"?
>
> Self-followup: should I use a unique Index instead? But how do you
> create a functional index in SQLAlchemy?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---