Skip to content

tometadata() doubles up unique constraint for unique=True #3721

@sqlalchemy-bot

Description

@sqlalchemy-bot

Migrated issue, originally created by Michael Bayer (@zzzeek)

from sqlalchemy import Table, MetaData, Column, Integer

m1 = MetaData()

t1 = Table(
    't', m1, Column('id', Integer, unique=True)
)

m2 = MetaData()

t2 = t1.tometadata(m2)

print t2.constraints

output:

set([UniqueConstraint(Column('id', Integer(), table=<t>)), PrimaryKeyConstraint(), UniqueConstraint(Column('id', Integer(), table=<t>))])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingschemathings related to the DDL related objects like Table, Column, CreateIndex, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions