Reputation: 49248
Let's say I create a table like this:
table = Table('mytable', metadata,
Column('a', Integer, primary_key=True),
Column('b', Integer, primary_key=True),
)
table.create()
Is it guaranteed that the primary key will be (a,b) and not (b,a)?
Upvotes: 0
Views: 420
Reputation: 75297
its guaranteed, yes, since Column
objects in Table
are ordered. or if you really want to be explicit, use PrimaryKeyContraint()
.
Upvotes: 5
Reputation: 24
USe echo=True and compare yours with a swapped version? That should give the answer.
Upvotes: 0
Reputation: 30953
Yes. It will be a really bad thing if resulting DDL wasn't giving consistent results.
Upvotes: 0