[sqlalchemy] multiple FK constraints and self referential

2012-02-08 Thread cropr
I aam having an issue defining a 2nd foreign key constraint on 2 derived classes of a base class that uses a self referential join. Base class:ContentBase class ContentBase(Base): __tablename__ = 'content' __mapper_args__ = {'polymorphic_on': ctype, 'polymorphic_identity':'contentbase'}

[sqlalchemy] Re: multiple FK constraints and self referential

2012-02-08 Thread cropr
. It is however strange that the latter worked fine for almost a year until I added a the 2nd FK in the derived classes On 8 feb, 16:44, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 8, 2012, at 9:39 AM, cropr wrote: I aam having an issue defining a 2nd foreign key constraint on 2 derived

[sqlalchemy] Adding a Column dynamically using a metaclass

2010-07-23 Thread cropr
I am trying to add a Column definition using a metaclass but things aren't working as expected I am using something like the code below class MyMeta(DeclarativeMeta): def __init__(cls, name, bases, attrdict): setattr(cls, 'title', Column(types.String(80))

[sqlalchemy] Re: self referential with 2 forign key constraints

2010-02-18 Thread cropr
thanks, that was it I looking for -- 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

[sqlalchemy] self referential with 2 forign key constraints

2010-02-17 Thread cropr
I have defined a self refential class ContentObject to build a node tree wih parent child relationships. class ContentObject(Base): __tablename__ = 'contentobject' _contentType = 'contentobject' id = Column(types.Integer, primary_key=True, autoincrement=True) parent_id =

[sqlalchemy] Re: relation to class in different file

2008-11-12 Thread cropr
Indeed this solves the issue Tnx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL

[sqlalchemy] declarative inheritance

2008-11-11 Thread cropr
Does somebody know if is possible to use a declarative class definition for the schema below content = Table('content', meta.metadata, Column('id', types.Integer, primary_key=True, autoincrement=True), Column('title', types.String(80)), Column('parent_id', types.Integer,

[sqlalchemy] relation to class in different file

2008-11-11 Thread cropr
I want to build a relation to a class located in a different file file user.py --- class Users(Base): __tablename__ = 'users' username = Column(types.String(32), primary_key=True) password = Column(types.String(32)) file content.py --- from user import