why don’t you set up your PrimaryKeyConstraint directly? class AbstractPK(NameByClass): """ this table defines a frequently used composite primary key """
@declared_attr def key1(cls): return Column(ForeignKey("somekey.keypart1"), primary_key=True) @declared_attr def key2(cls): return Column(ForeignKey("anotherkey.keypart2"), primary_key=True) key3 = Column( Integer, primary_key=True ) @declared_attr def __table_args__(self): return ( PrimaryKeyConstraint('key1', 'key2', 'key3'), ) Sven Teresniak <realkno...@gmail.com> wrote: > > Am Freitag, 2. Juli 2010 02:24:05 UTC+2 schrieb Michael Bayer: > The Column object contains a "sort key" when constructed, against a single > global value, that is used as a sort key when the Table is generated. This > is to get around the fact that the attribute dictionary of the declarative > class is unordered. > > The mixin columns should copy their "sort key" over, or it should somehow be > tailored in the declarative base so that the order of the two columns stays > relatively the same, and perhaps is also tailored to be at the same position > relative to the other columns in the ultimate table. > > I'd welcome any patches in this regard since I don't usually deal with the > "mixin" feature. > > Is there any simple way to modify/set this "sort key" or is there any way for > me to workaround this random ordering in the class dict? Or to simple inspect > the ordering to generate code that re-orders my primary composite key parts > accordingly? > > Thanks > Sven > > -- > 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 sqlalchemy+unsubscr...@googlegroups.com > <mailto:sqlalchemy+unsubscr...@googlegroups.com>. > To post to this group, send email to sqlalchemy@googlegroups.com > <mailto:sqlalchemy@googlegroups.com>. > Visit this group at http://groups.google.com/group/sqlalchemy > <http://groups.google.com/group/sqlalchemy>. > For more options, visit https://groups.google.com/d/optout > <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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.