Re: [SQLObject] Get Join instance for attribute
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2013-09-17 19:05:50
|
Hi! On Tue, Sep 17, 2013 at 08:19:13PM +0200, to...@ce... wrote: > To work with foo = RelatedJoin('Song') we use .foo, .addSong and .removeSong. But those names are configurable. How do I get them when all I know is "foo"? > > One way seems to be sqlmeta.joins[0].performJoin, .add and .remove. Is that an internal API, and subject to change? I have less and less time to work on SQLObject so until someone replaces me as the developer there will be no major changes for quite some time. > How do I get the list index? By looking up the join object you're interested in: class Test1(SQLObject): test2 = RelatedJoin('Test2') class Test2(SQLObject): test1 = RelatedJoin('Test1') for j in Test2.sqlmeta.joins: print j.joinMethodName, j.otherClassName, j.addRemoveName Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |