[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread az
put it as text, it will be eval()'uated later On Monday 16 February 2009 10:57:11 一首诗 wrote: I tried to write : #-- -- class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True)

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This is covered by the decl. layer documentation (including examples): - either use strings for the parameter or - you write outside the class scope User.sons = relation() - -aj On 16.02.2009 9:57 Uhr, 一首诗 wrote: I tried to write :

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread 一首诗
Like this ? class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) fullname = Column(String) password = Column(String) sons =

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread az
thats diff. thing, see self-ref. relations http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relationships On Monday 16 February 2009 11:18:59 一首诗 wrote: Like this ? --- - class User(Base):

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread Alexandre Conrad
So, does sqlalchemy support self 2 self relationship ? If the answer is YES, how to do it? You may want to look at the remote_side keyword argument. http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relationships Regards, Alex

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread Alexandre Conrad
As I said in my previous mail, you really should look at the remote_side keyword argument in your relation. This is what it was done for and the paragraph adjacency-list-relationships from the documentation covers all you need to know to deal with self-referential relationships. Here's the link