Re: [SQLObject] Intermediate table in RelatedJoins
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Miguel T. <mig...@gm...> - 2009-08-12 09:20:54
|
Hi Oleg, Hum... shouldn't it create a target_capability too? Aren't there scenarios where the two relation might be independent? Like A having several B and B having several different A? Sorry for the missing VirtualMachine class. ############################################################################## class VirtualMachine (sqlobject.SQLObject): """ Virtual machine (with it's DB representation) """ name = sqlobject.StringCol (unique=True) script = sqlobject.StringCol () IP = sqlobject.StringCol () username = sqlobject.StringCol () rpms = sqlobject.IntCol () ############################################################################## Best regards, Miguel Tavares 2009/8/12 Oleg Broytmann <ph...@ph...> > > On Wed, Aug 12, 2009 at 09:28:33AM +0100, Jos?? Miguel Pereira Tavares wrote: > > sqlobject/main.py: > > 1469 if join.soClass.__name__ > join.otherClass.__name__: > > 1470 continue > > 1471 joins.append(join) > > > > What this lines seam to do is stop any Many-to-Many relations where the > > first class as a "lower" name than the second on. > > > > Is this intended? If so why? > > To prevent the intermediate table to be created twice. > > > Example snipet: > > Works for me (without VirtualMachine class): > > Capability.createTable() > Target.createTable() > > prints > > 1/QueryR : CREATE TABLE capability ( > id INTEGER PRIMARY KEY, > name TEXT, > description TEXT > ) > 2/Query : CREATE TABLE capability_target ( > capability_id INT NOT NULL, > target_id INT NOT NULL > ) > 2/QueryR : CREATE TABLE capability_target ( > capability_id INT NOT NULL, > target_id INT NOT NULL > ) > 3/Query : CREATE TABLE target ( > id INTEGER PRIMARY KEY, > name TEXT, > i_p TEXT > ) > > > Target.createTable() > Capability.createTable() > > prints > > 1/QueryR : CREATE TABLE target ( > id INTEGER PRIMARY KEY, > name TEXT, > i_p TEXT > ) > 2/QueryR : CREATE TABLE capability ( > id INTEGER PRIMARY KEY, > name TEXT, > description TEXT > ) > 3/Query : CREATE TABLE capability_target ( > capability_id INT NOT NULL, > target_id INT NOT NULL > ) > > Ok? > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss |