On Jun 26, 2013, at 12:02 PM, Mat Mathews <m...@miga.me> wrote: > I would like to do something like this: > > class User(object): > id = Column(Integer, Sequence('user_id_seq', start=10000), > primary_key=True) > > This does work, and emits the CREATE SEQUENCE, but does not set the owned > table or the column to user.id
I'm not able to reproduce, even assigning the same sequence name to two different tables simultaneously produces the correct result. Can you modify the test below to illustrate your issue? from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base, declared_attr Base = declarative_base() class IdMixin(object): id = Column(Integer, Sequence('user_id_seq', start=10000), primary_key=True) class A(IdMixin, Base): __tablename__ = 'a' class B(IdMixin, Base): __tablename__ = 'b' e = create_engine("postgresql://scott:tiger@localhost/test", echo=True) Base.metadata.drop_all(e) Base.metadata.create_all(e) sess = Session(e) a1 = A() sess.add(a1) b1 = B() sess.add(b1) sess.commit() assert a1.id == 10000 assert b1.id == 10001 -- 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/groups/opt_out.