Hi All, In 0.6_beta2, the following code is not properly adding a primary key Column via DeclarativeMeta which calls my PrimaryKey() function:
def PrimaryKey(seqprefix): return Column(Integer, Sequence(seqprefix, optional=True), primary_key=True) class ClassDefaults(DeclarativeMeta): def __init__(cls,classname, bases, dict_): seqprefix = getattr(cls,'__tablename__',None) dict_['id'] = PrimaryKey(seqprefix=seqprefix) return DeclarativeMeta.__init__(cls, classname, bases, dict_) Base = declarative_base(metaclass=ClassDefaults) class Location(Base): __tablename__ = 'location' parent_id = Column(Integer, ForeignKey('location.id')) parent = relation('Location', backref=backref('children'), remote_side='location.c.id') name = UniqueString(25) desc = Column(String(80)) SQLAlchemy 0.6_beta2 complains on table initialization: File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 444, in _configure_pks "key columns for mapped table '%s'" % (self, self.mapped_table.description)) sqlalchemy.exc.ArgumentError: Mapper Mapper|Location|location could not assemble any primary key columns for mapped table 'location' This worked under 0.6_beta1 (and likely earlier versions of SQLAlchemy). Can someone send me some code similar to above that works with 0.6_beta2, or is this a bug in beta2? Thanks, Daniel -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.