sure, use UniqueConstraint directly. It's better to use that than the
unique=True flag in any case.
On 5/3/15 10:29 PM, [email protected] wrote:
Is there a way to control whether DDL emitted by SQLAlchemy uses a
column and/or table constraint for uniqueness?
It seems the following
|
classPart(Base):
__tablename__ ='part'
third_party_id =Column(Integer,nullable=True,default=None,unique=True)
|
emits a table constraint
|
CREATE TABLE part (
third_party_id INTEGER,
CONSTRAINT uq_part_third_party_id UNIQUE (third_party_id)
)
|
Is it possible to emit the following with a column constraint instead?
|
CREATE TABLE part (
third_party_id INTEGER CONSTRAINT uq_part_third_party_id UNIQUE
)
|
Thanks
--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.